feat(merlin/phase-a): Phase A complete — camera daemon, OS input injection, manage.sh
This commit is contained in:
parent
5d66dbb56b
commit
6188f332ba
1 changed files with 48 additions and 0 deletions
48
manage.sh
Executable file
48
manage.sh
Executable file
|
|
@ -0,0 +1,48 @@
|
|||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
CMD=${1:-help}
|
||||
PIDFILE="/tmp/merlin-daemon.pid"
|
||||
LOGFILE="/tmp/merlin-daemon.log"
|
||||
|
||||
case "$CMD" in
|
||||
start)
|
||||
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
|
||||
echo "Merlin already running (pid $(cat "$PIDFILE"))"
|
||||
exit 0
|
||||
fi
|
||||
conda run -n cf python -m merlin.daemon >> "$LOGFILE" 2>&1 &
|
||||
echo $! > "$PIDFILE"
|
||||
echo "Merlin started (pid $!). Logs: $LOGFILE"
|
||||
;;
|
||||
stop)
|
||||
if [ -f "$PIDFILE" ]; then
|
||||
kill "$(cat "$PIDFILE")" 2>/dev/null && echo "Merlin stopped"
|
||||
rm -f "$PIDFILE"
|
||||
else
|
||||
echo "Merlin not running"
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
bash "$0" stop
|
||||
sleep 1
|
||||
bash "$0" start
|
||||
;;
|
||||
status)
|
||||
if [ -f "$PIDFILE" ] && kill -0 "$(cat "$PIDFILE")" 2>/dev/null; then
|
||||
echo "Running (pid $(cat "$PIDFILE"))"
|
||||
curl -s http://localhost:8522/status | python3 -m json.tool
|
||||
else
|
||||
echo "Stopped"
|
||||
fi
|
||||
;;
|
||||
logs)
|
||||
tail -f "$LOGFILE"
|
||||
;;
|
||||
test)
|
||||
conda run -n cf pytest tests/ -v
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 start|stop|restart|status|logs|test"
|
||||
;;
|
||||
esac
|
||||
Loading…
Reference in a new issue