| #!/usr/bin/env bash |
| set -uo pipefail |
|
|
| echo "=== Hermes Agent (HF Space) starting ===" |
|
|
| |
| |
| |
| |
| |
| bash /home/user/app/scripts/configure_cloudflare.sh || true |
|
|
| bash /home/user/app/scripts/restore_hermes.sh || true |
|
|
| bash /home/user/app/scripts/configure_hermes.sh |
|
|
| bash /home/user/app/scripts/configure_startup.sh || true |
|
|
| |
| |
| |
| |
| |
| SUPERVISOR_PID="" |
| graceful_shutdown() { |
| echo "[entrypoint] caught shutdown signal; syncing state before exit..." |
| python3 -c "from app.backup import run_backup; print('[entrypoint] shutdown sync result:', run_backup())" 2>&1 || true |
| if [ -n "$SUPERVISOR_PID" ] && kill -0 "$SUPERVISOR_PID" 2>/dev/null; then |
| kill -TERM "$SUPERVISOR_PID" 2>/dev/null || true |
| wait "$SUPERVISOR_PID" 2>/dev/null || true |
| fi |
| exit 0 |
| } |
| trap graceful_shutdown SIGTERM SIGINT |
|
|
| supervisord -c /home/user/app/supervisord.conf & |
| SUPERVISOR_PID=$! |
| wait "$SUPERVISOR_PID" |
|
|