#!/bin/sh
#
# This script should reload your bot if it goes down. It's based on
# eggdrop' botchk.
#
# To check for your bot every 10 minutes, put the following line in your
# crontab:
#    0,10,20,30,40,50 * * * *   /home/loginname/mudbot/reloadbot
# 
#
botdir="/home/your_login/mudbot"


# Edit the botdir and put up the crontab, and that's all! 
#







cd $botdir
if test -r mudbot.pid; then
  # there is a pid file -- is it current?
  botpid=`cat mudbot.pid`
  if `kill -CHLD $botpid >/dev/null 2>&1`; then
    # it's still going
    # back out quietly
    exit 0
  fi
  rm -f mudbot.pid
fi
echo ""
echo "Reloading MudBot..."
echo ""
./mudbot
