initial: import DOLPHIN baseline 2026-04-21 from dolphinng5_predict working tree
Includes core prod + GREEN/BLUE subsystems: - prod/ (BLUE harness, configs, scripts, docs) - nautilus_dolphin/ (GREEN Nautilus-native impl + dvae/ preserved) - adaptive_exit/ (AEM engine + models/bucket_assignments.pkl) - Observability/ (EsoF advisor, TUI, dashboards) - external_factors/ (EsoF producer) - mc_forewarning_qlabs_fork/ (MC regime/envelope) Excludes runtime caches, logs, backups, and reproducible artifacts per .gitignore.
This commit is contained in:
90
prod/scan_bridge_restart.sh
Executable file
90
prod/scan_bridge_restart.sh
Executable file
@@ -0,0 +1,90 @@
|
||||
#!/bin/bash
|
||||
# Scan Bridge Service Manager
|
||||
# Usage: ./scan_bridge_restart.sh [start|stop|restart|status]
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
LOG_FILE="/tmp/scan_bridge.log"
|
||||
PID_FILE="/tmp/scan_bridge.pid"
|
||||
|
||||
# Activate environment
|
||||
source /home/dolphin/siloqy_env/bin/activate
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -f "$PID_FILE" ] && kill -0 $(cat "$PID_FILE") 2>/dev/null; then
|
||||
echo "Scan bridge already running (PID: $(cat $PID_FILE))"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Starting scan bridge..."
|
||||
cd "$SCRIPT_DIR"
|
||||
nohup python3 scan_bridge_service.py > "$LOG_FILE" 2>&1 &
|
||||
echo $! > "$PID_FILE"
|
||||
sleep 2
|
||||
|
||||
if kill -0 $(cat "$PID_FILE") 2>/dev/null; then
|
||||
echo "✓ Started (PID: $(cat $PID_FILE))"
|
||||
else
|
||||
echo "✗ Failed to start"
|
||||
rm -f "$PID_FILE"
|
||||
fi
|
||||
;;
|
||||
|
||||
stop)
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat "$PID_FILE")
|
||||
if kill -0 "$PID" 2>/dev/null; then
|
||||
echo "Stopping scan bridge (PID: $PID)..."
|
||||
kill "$PID"
|
||||
sleep 2
|
||||
rm -f "$PID_FILE"
|
||||
echo "✓ Stopped"
|
||||
else
|
||||
echo "Process not running"
|
||||
rm -f "$PID_FILE"
|
||||
fi
|
||||
else
|
||||
echo "No PID file found, killing any scan_bridge processes..."
|
||||
pkill -f "scan_bridge_service.py" 2>/dev/null
|
||||
echo "✓ Stopped"
|
||||
fi
|
||||
;;
|
||||
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
|
||||
status)
|
||||
if [ -f "$PID_FILE" ]; then
|
||||
PID=$(cat "$PID_FILE")
|
||||
if kill -0 "$PID" 2>/dev/null; then
|
||||
echo "✓ Scan bridge running (PID: $PID)"
|
||||
echo " Uptime: $(ps -o etime= -p $PID 2>/dev/null | tr -d ' ')"
|
||||
echo " Log: $LOG_FILE"
|
||||
else
|
||||
echo "✗ Process dead (stale PID file)"
|
||||
rm -f "$PID_FILE"
|
||||
fi
|
||||
else
|
||||
if pgrep -f "scan_bridge_service.py" > /dev/null 2>&1; then
|
||||
echo "⚠ Running but no PID file"
|
||||
else
|
||||
echo "✗ Not running"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Show last log entries
|
||||
if [ -f "$LOG_FILE" ]; then
|
||||
echo ""
|
||||
echo "Last 3 log entries:"
|
||||
tail -3 "$LOG_FILE" | grep -E "(Pushed|ACTIVE|ERROR)"
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
echo "Usage: $0 [start|stop|restart|status]"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
Reference in New Issue
Block a user