#!/bin/sh
# Aviation (c) 1998 by Mixter
# Shell script to update your crontab file
# 1st config file should be "conf"
# usage: ./mkcron [eggdrop-executable]
if test -z $1 ; then echo "usage: ./mkcron [eggdrop-executable]" ; exit ; fi
if [ ! -f $1 ] ; then echo "eggdrop executable "$1" doesnt exist" ; exit ; fi
eggname=$1
echo "#!/bin/sh" > bchk
echo cd \"`pwd`\" >> bchk
echo "if [ ! -f pid.* ] ; then" >> bchk
echo ./shad \"`whoami`\" ./$eggname conf >> bchk
echo "exit ; fi" >> bchk
echo botpid=\`cat pid.\*\` >> bchk
echo if \`kill -CHLD \$botpid \>/dev/null 2\>\&1\`\; then >> bchk
echo ./shad \"`whoami`\" ./$eggname conf >> bchk
echo "exit ; fi" >> bchk
echo "rm -f pid.*" >> bchk
echo ./shad \"`whoami`\" ./$eggname conf >> bchk
echo exit 0 >> bchk
chmod 755 bchk
printf "5,15,25,35,45,55 * * * *   \"`pwd`/bchk\" >/dev/null 2>&1\n" >cron
crontab cron
crontab -l
