#!/bin/sh
# This is the crontab script for psybnc.
#
# Please change the following path to your psybnc-directory.
#
# To run this script through cron, edit your crontab with crontab -e
# Then insert a line similar to:
# 0,10,20,30,40,50 * * * * /home/foobar/psybnc/psybncchk
# That will cause crontab to check if psyBNC is running every tenth minute
PSYBNCPATH=/home/foobar/psybnc

# the rest should be kept as is

if test -r $PSYBNCPATH/psybnc.pid; then
    PSYPID=$(cat $PSYBNCPATH/psybnc.pid)
    if $(kill -CHLD $PSYPID >/dev/null 2>&1)
    then
	exit 0
    fi
fi
cd $PSYBNCPATH
./psybnc &>/dev/null
