#!/bin/bash echo "=== stopping deployer + any stray builds ===" sudo systemctl stop hal8-deployer.timer hal8-deployer.service 2>/dev/null sudo systemctl disable hal8-deployer.timer 2>/dev/null sudo pkill -f "docker build" 2>/dev/null; sudo pkill -f vite 2>/dev/null sleep 2 echo "=== hal8 container state ===" sudo docker inspect hal8-hal8-1 --format 'status={{.State.Status}} restarts={{.RestartCount}} oomkilled={{.State.OOMKilled}} exitcode={{.State.ExitCode}} started={{.State.StartedAt}}' echo "=== last 25 hal8 logs ===" sudo docker logs --tail 25 hal8-hal8-1 2>&1 echo "=== memory now ===" free -m | head -2 echo "=== clean restart on quiet box ===" sudo docker restart hal8-hal8-1 >/dev/null echo "restarted; waiting 100s for boot..." sleep 100 for i in 1 2 3 4 5 6; do code=$(curl -s -o /dev/null -w "%{http_code}" --max-time 15 https://hal8.odyssey-works.io/auth || echo 000) echo "health check $i: HTTP $code" [ "$code" = "200" ] && break sleep 20 done sudo docker inspect hal8-hal8-1 --format 'final: status={{.State.Status}} oomkilled={{.State.OOMKilled}}' free -m | head -2