Files
P42_godDaemons/Maestro/startMaestro.sh
T
2026-06-20 18:50:26 +00:00

34 lines
531 B
Bash
Executable File

#!/bin/sh
set -a
. /etc/p42/secrets.env
set +a
daemon=p42Maestro
logfile=maestro.log
pid=$(pgrep -f "$daemon")
if [ -z "$pid" ]
then
node "${daemon}.js" --debug > "$logfile" 2>&1 &
pid=$!
sleep 1
if kill -0 "$pid" 2>/dev/null
then
echo ""
echo "$daemon is now running with PID=$pid"
echo ""
else
echo ""
echo "Failed to start $daemon. Check maestro.log"
echo ""
fi
else
echo ""
echo "$daemon is already running with PID=$pid"
echo ""
fi