#!/bin/sh
# Entity (c) 1996-2000 by Mixter
# Shell script to update your crontab file

echo -n "Name of your executable (normally 'e'): " ; read fd
if test -z $fd ; then echo Please try again. ; exit ; fi
if [ ! -f $fd ] ; then echo "eggdrop executable "$fd" doesnt exist" ; exit ; fi
eggname=$fd

echo -n "Nickname of your bot: " ; read fd
if test -z $fd ; then echo Please try again. ; exit ; fi
if [ ! -f conf.${fd} ] ; then echo "your config file conf."$fd" doesnt exist" ; exit ; fi
eggnick=$fd

echo "#!/bin/sh" > bchk ; echo cd \"`pwd`\" >> bchk
echo "if [ ! -f pid.* ] ; then" >> bchk
echo ./conf.${eggnick} >> bchk
echo "exit ; fi" >> bchk
echo botpid=\`cat pid.\*\` >> bchk
echo if \`kill -CHLD \$botpid \>/dev/null 2\>\&1\`\; then >> bchk
echo ./conf.${eggnick} >> bchk
echo "exit ; fi" >> bchk
echo "rm -f pid.*" >> bchk
echo ./conf.${eggnick} >> 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
