cleand config file & more

This commit is contained in:
STEINNI
2026-06-13 14:21:20 +00:00
parent bf6065eaf0
commit 8d686b54d4
7 changed files with 179 additions and 14 deletions
+25 -6
View File
@@ -1,13 +1,32 @@
#!/bin/sh
cd /opt/p42api/
. /etc/p42/secrets.env
daemon=p42api
logfile=p42api.log
pid=$(pgrep -f "$daemon")
pid=`ps -ef | grep p42api |grep -v grep | awk '{print $2}'`
if [ -z "$pid" ]
then
node p42api.js > p42api.log 2>&1 &
node "${daemon}.js" > "$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 p42api.log"
echo ""
fi
else
echo ''
echo 'Already running PID='"$pid"' (use stopApi.sh to stop it)'
echo ''
echo ""
echo "$daemon is already running with PID=$pid"
echo ""
fi