#!/bin/tcsh.exe -f
#
# CircleMUD 2.0 autorun script
# Originally by Fred C. Merkel
# Copyright (c) 1993 The Trustees of The Johns Hopkins University
# All Rights Reserved
# See license.doc for more information
# Modifed by Christopher Dickey, Rift, Dunkelzahn, and Demise.
# (c)2001 The AwakeMUD Consortium
# If .fastboot exists, the script will sleep for only 5 seconds between reboot
# attempts. If .killscript exists, the script commit suicide (and remove
# .killscript). If pause exists, the script will repeatedly sleep for
# 60 seconds and will not restart the mud until pause is removed.
set PORT=4000
set FLAGS=''
while (1)
set DATE = (`date`);
echo "autoscript starting game $DATE" >> syslog
cp bin/newsvr.exe bin/awake.exe
bin/awake.exe $FLAGS $PORT >>& syslog
#gdb bin/awake.exe < gdbcmds >>& syslog
echo "" >> syslog
tail -25 syslog >> log/crashlog
fgrep "self-delete" syslog >> log/delete
fgrep "DEATHLOG" syslog >> log/deathlog
fgrep "Running" syslog >> log/restarts
fgrep "advanced" syslog >> log/levels
fgrep "equipment lost" syslog >> log/rentgone
fgrep "usage" syslog >> log/usage
fgrep "new player" syslog >> log/newplayers
fgrep "CONNLOG" syslog >> log/connlog
fgrep "MISCLOG" syslog >> log/misclog
fgrep "SYSLOG" syslog >> log/syslog
fgrep "WIZLOG" syslog >> log/wizlog
fgrep "Bad PW" syslog >> log/badpws
# here we mail the syslog to whoever the admin is so they know the
# mud crashed (if it crashed at all)
mv -f lib/core.1 lib/core.2
mv -f lib/core lib/core.1
rm log/syslog.1
mv log/syslog.2 log/syslog.1
mv log/syslog.3 log/syslog.2
mv log/syslog.4 log/syslog.3
mv log/syslog.5 log/syslog.4
mv log/syslog.6 log/syslog.5
mv syslog log/syslog.6
touch syslog
if (! -r .fastboot) then
sleep 40
else
rm .fastboot
sleep 5
endif
if (-r .killscript) then
set DATE = (`date`);
echo "autoscript killed $DATE" >> syslog
rm .killscript
exit
endif
while (-r pause)
sleep 60
end
end