Files
P42_godDaemons/GPS/startGps.sh
T

36 lines
521 B
Bash
Executable File

#!/bin/sh
set -a
. /etc/p42/secrets.env
set +a
daemon=p42Gps
logfile=gps.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 gps.log"
echo ""
fi
else
echo ""
echo "$daemon is already running with PID=$pid"
echo ""
fi