Re: [ADMIN] cron script

From: Mark A. Heilpern (heilpern@MINDSPRING.COM)
Date: 12/09/97


My crontab entry:    ("crontab -e" to make yours)
-------------------------------------------------
*/5 * * * * /home/mud/mudchk





An addition to my autorun script (which is called
"autorun.equoria") to make the mudchk script work:
(put this before the while-loop)
-------------------------------------------------
ps -x | grep "autorun.equoria" | grep -v grep | awk '{print $1}' >pid.equoria






My /home/mud/mudchk script:
-------------------------------------------------
#!/bin/bash

# change this to the directory you run your mud from:
muddir="/home/mud/mud"

# change this to the name of your mud's script in that directory:
mudscript="autorun.equoria"

# change this to the nickname of your mud (capitalization COUNTS)
mudname="equoria"

cd $muddir
if test -r pid.equoria; then
  # there is a pid file -- is it current?
  mudpid=`cat pid.equoria`
  if `kill -CHLD $mudpid >/dev/null 2>&1`; then
    # it's still going
    # back out quietly
    exit 0
  fi
#  echo ""
#  echo "Stale pid.$mudname file (erasing it)"
  rm -f pid.equoria
fi
#echo ""
#echo "Couldn't find the mud running.  Reloading it..."
#echo ""
./$mudscript &


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST