sBNCchk - Keep-alive using crontab

psyBNC comes with a clever and simple shell-script, that starts it up if it isn't already running. Combined with crontab this makes for a good way to ensure it gets started up at reboot, and in case the bouncer should crash. The script below was made by the authors of psyBNC, just edited to work for sBNC. Neither I, nor they, should be held responsible for any damage this could do to your system (standard issue disclaimer).

  • Place the following shell-script in a file called sbncchk.sh in ~/sbnc/ (change username to the user running sBNC):
#!/bin/sh
SBNCPATH=/home/username/sbnc
 
if test -r $SBNCPATH/sbnc.pid; then
    SBNCPID=$(cat $SBNCPATH/sbnc.pid)
    if $(kill -CHLD $SBNCPID >/dev/null 2>&1)
    then
	exit 0
    fi
fi
cd $SBNCPATH
./sbnc &>/dev/null
  • Change it's permissions to be executeable (in a shell, same folder as the file):
chmod +x sbncchk.sh
  • Open up your local crontab file in the crontab editor, like so (in a shell):
crontab -e
  • Put the following two lines into the crontab (should not need to modify this):
@reboot       $HOME/sbnc/sbncchk.sh > /dev/null 2>&1
*/10 * * * *  $HOME/sbnc/sbncchk.sh > /dev/null 2>&1
  • It will now be run at start-up and every 10 minutes. Checking if sBNC is running, and start it if it's not.
sbnc/chk.txt · Last modified: 2007/01/12 14:02 by zyberdog