2020-06-21 04:01:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2023-12-09 05:03:14 +00:00
|
|
|
export PIDDIR=${PIDDIR:-/var/run}
|
2020-06-21 04:01:30 +00:00
|
|
|
export SBBSCTRL=/opt/sbbs/ctrl
|
2023-12-09 05:03:14 +00:00
|
|
|
PIDFILE=${PIDDIR}/sbbs.pid
|
2020-06-21 04:01:30 +00:00
|
|
|
|
|
|
|
# Proxy signals
|
|
|
|
function kill_app(){
|
2023-12-09 05:03:14 +00:00
|
|
|
kill $(cat ${PIDFILE})
|
2020-06-21 04:01:30 +00:00
|
|
|
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
|
2024-12-23 01:52:52 +00:00
|
|
|
NAME=$(basename $(cat /proc/${SBBS_PID}/cmdline |awk 'BEGIN { FS = "\0" } ;{print $(NF-2)}'))
|
2020-06-21 04:01:30 +00:00
|
|
|
#echo "* SBBS NAME [${NAME}]"
|
|
|
|
|
2023-12-09 05:03:14 +00:00
|
|
|
if [ "${NAME}" != "sbbs" -a "${NAME}" != "/mnt/lima-rosetta/rosetta" ]; 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
|