Files
momentry_core/run-server-3002.sh
T

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)
"$0" stop
"$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