From: Remco Rijnders Date: Sat, 7 Dec 2013 11:57:41 +0000 (+0100) Subject: Add simple script to check for running ircd in cron X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=6b286e08de92a34c03b5dab9d775d75510375a22;p=serene-ircd.git Add simple script to check for running ircd in cron --- diff --git a/ircdchk b/ircdchk new file mode 100755 index 0000000..7dcb813 --- /dev/null +++ b/ircdchk @@ -0,0 +1,18 @@ +# simple ircdchk +# edit where applicable +# crontab: */7 * * * * /home/ircd/ircd/ircdchk + +ircdexe="/home/ircd/ircd/ircd" +ircdpidfile="/home/ircd/ircd/ircd.pid" + +if test -r $ircdpidfile; then + ircdpid=`cat $ircdpidfile` + if `kill -CHLD $ircdpid >/dev/null 2>&1`; then + # running process, exit without output + exit 0 + fi + echo "Stale PID $ircdpidfile, removing" + rm -f $ircdpidfile +fi +echo "Restarting stopped ircd" +$ircdexe