sbbs/start.sh
2023-05-24 20:19:38 +10:00

38 lines
618 B
Bash
Executable File

#!/bin/bash
export SBBSCTRL=/opt/sbbs/ctrl
PIDFILE=/var/run/sbbs.pid
# Proxy signals
function kill_app(){
kill $(cat ${SBBS_PID})
exit 0 # exit okay
}
trap "kill_app" SIGINT SIGTERM
sbbs -d
sleep 5
SBBS_PID=$(cat ${PIDFILE})
echo "* SBBS PID [${SBBS_PID}]"
if [ -n ${SBBS_PID} ]; then
while [ -d /proc/${SBBS_PID} ]; do
NAME=$(cat /proc/${SBBS_PID}/cmdline |awk 'BEGIN { FS = "\0" } ;{print $1}')
#echo "* SBBS NAME [${NAME}]"
if [ "${NAME}" != "sbbs" ]; then
echo "! Name not matching? [${NAME}]"
break;
fi
sleep 15
done
echo "? SBBS stopped"
else
echo "? NO SBBS PID?"
fi
exit 1