2020-06-21 04:01:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
export SBBSCTRL=/opt/sbbs/ctrl
|
|
|
|
PIDFILE=/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
|
2022-10-17 11:57:20 +00:00
|
|
|
NAME=$(cat /proc/${SBBS_PID}/cmdline |awk 'BEGIN { FS = "\0" } ;{print $1}')
|
2020-06-21 04:01:30 +00:00
|
|
|
#echo "* SBBS NAME [${NAME}]"
|
|
|
|
|
2020-08-02 07:52:09 +00:00
|
|
|
if [ "${NAME}" != "sbbs" ]; then
|
2020-06-21 04:01:30 +00:00
|
|
|
echo "! Name not matching? [${NAME}]"
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
|
|
|
|
sleep 15
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "? SBBS stopped"
|
|
|
|
else
|
|
|
|
echo "? NO SBBS PID?"
|
|
|
|
fi
|
|
|
|
|
|
|
|
exit 1
|