sbbs/start.sh

39 lines
713 B
Bash
Raw Normal View History

#!/bin/bash
export PIDDIR=${PIDDIR:-/var/run}
export SBBSCTRL=/opt/sbbs/ctrl
PIDFILE=${PIDDIR}/sbbs.pid
# Proxy signals
function kill_app(){
kill $(cat ${PIDFILE})
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=$(basename $(cat /proc/${SBBS_PID}/cmdline |awk 'BEGIN { FS = "\0" } ;{print $(NF-2)}'))
#echo "* SBBS NAME [${NAME}]"
if [ "${NAME}" != "sbbs" -a "${NAME}" != "/mnt/lima-rosetta/rosetta" ]; then
echo "! Name not matching? [${NAME}]"
break;
fi
sleep 15
done
echo "? SBBS stopped"
else
echo "? NO SBBS PID?"
fi
exit 1