feat: Add gt rig boot command to start witness and refinery

Inverse of 'gt rig shutdown'. Starts rig patrol agents:
- Checks tmux sessions to avoid duplicates
- Starts witness if not running
- Starts refinery if not running
- Reports what was started vs skipped

Also adds ProcessExists util function needed by witness/refinery managers.
This commit is contained in:
Steve Yegge
2025-12-28 19:19:10 -08:00
parent cdbe5d0a1e
commit 7606bc884a
2 changed files with 117 additions and 0 deletions

View File

@@ -1,3 +1,24 @@
// Package util provides utility functions for Gas Town.
// This file was created as part of an E2E polecat workflow test.
package util
import (
"os"
"syscall"
)
// ProcessExists checks if a process with the given PID exists.
// It sends signal 0 to the process, which doesn't actually send a signal
// but does perform error checking to see if the process exists.
func ProcessExists(pid int) bool {
if pid <= 0 {
return false
}
process, err := os.FindProcess(pid)
if err != nil {
return false
}
// Signal 0 checks if process exists without sending a real signal
err = process.Signal(syscall.Signal(0))
return err == nil
}