#!/usr/local/bin/bash
# 42 is our magic number for not rebooting,
# otherwise we assume it crashed or we said reboot.
echo $$ >/home/wiley/wiley.pid
cd /home/wiley/wiley/bin
while [ -x ./wileymud ]; do
LOG=`/bin/date "+../lib/log/runlog.%y%m%d-%H%M%S"`
touch $LOG
chmod 640 $LOG
./wileymud 3000 >$LOG 2>&1 </dev/null
STATUS=$?
bzip2 -9 $LOG
chmod 640 $LOG.bz2
sync
if [ $STATUS = 42 ]; then
exit
fi
sleep 240
done