Updated start.sh, to allow for different PID location

This commit is contained in:
Deon George 2023-12-09 16:03:14 +11:00
parent 0cf79f7354
commit ffae70dabb

View File

@ -1,11 +1,12 @@
#!/bin/bash #!/bin/bash
export PIDDIR=${PIDDIR:-/var/run}
export SBBSCTRL=/opt/sbbs/ctrl export SBBSCTRL=/opt/sbbs/ctrl
PIDFILE=/var/run/sbbs.pid PIDFILE=${PIDDIR}/sbbs.pid
# Proxy signals # Proxy signals
function kill_app(){ function kill_app(){
kill $(cat ${SBBS_PID}) kill $(cat ${PIDFILE})
exit 0 # exit okay exit 0 # exit okay
} }
trap "kill_app" SIGINT SIGTERM trap "kill_app" SIGINT SIGTERM
@ -21,7 +22,7 @@ if [ -n ${SBBS_PID} ]; then
NAME=$(cat /proc/${SBBS_PID}/cmdline |awk 'BEGIN { FS = "\0" } ;{print $1}') NAME=$(cat /proc/${SBBS_PID}/cmdline |awk 'BEGIN { FS = "\0" } ;{print $1}')
#echo "* SBBS NAME [${NAME}]" #echo "* SBBS NAME [${NAME}]"
if [ "${NAME}" != "sbbs" ]; then if [ "${NAME}" != "sbbs" -a "${NAME}" != "/mnt/lima-rosetta/rosetta" ]; then
echo "! Name not matching? [${NAME}]" echo "! Name not matching? [${NAME}]"
break; break;
fi fi