Files
momentry_core/run-server-3002.sh
T
Accusys 149226ff17 fix: production service auto-start via launchd + fix worker retry loop
- Replaced old wrapper script with two launchd plists (server + worker)
- Both services auto-start at login via RunAtLoad + KeepAlive
- Removed MOMENTRY_FORCE_RETRY=true from .env to prevent infinite retries
- Added REDIS_URL and all required env vars to launchd plists
- Truncated 3.6GB of oversized logs (2.3G worker + 1.3G launchd stdout)
- Deleted 1214 orphaned processor_results records
- Updated run-server-3002.sh to manage via launchctl
- Removed obsolete wrapper scripts
2026-07-07 05:41:09 +08:00

31 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Start production server via launchd
set -euo pipefail
case "${1:-}" in
stop)
echo "Stopping production server and worker..."
launchctl bootout gui/$(id -u)/com.momentry.server 2>/dev/null || true
launchctl bootout gui/$(id -u)/com.momentry.worker 2>/dev/null || true
echo "Stopped."
;;
restart)
exec "$0" stop
exec "$0" start
;;
status)
echo "=== Server ==="
launchctl list com.momentry.server 2>/dev/null | head -5 || echo "Not loaded"
echo "=== Worker ==="
launchctl list com.momentry.worker 2>/dev/null | head -5 || echo "Not loaded"
echo "=== Health ==="
curl -s --max-time 3 http://localhost:3002/api/v1/health 2>/dev/null || echo "No response"
;;
*)
echo "Starting production server and worker via launchd..."
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.momentry.server.plist 2>/dev/null || launchctl load ~/Library/LaunchAgents/com.momentry.server.plist
launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.momentry.worker.plist 2>/dev/null || launchctl load ~/Library/LaunchAgents/com.momentry.worker.plist
echo "Done. Use '$0 status' to check."
;;
esac