#!/bin/tcsh
#
# Restart Lpmud a lot of times, in case of a crash.
#
limit datasize 55M
limit coredumpsize 20M
umask 2
cd /mud/lib
rm syslog/lplog[0-9]*
touch syslog/last_restart
rm syslog/last_restart
while (1)
	foreach i (0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50)
	    touch syslog/lplog$i
	    echo -n "Restart $i. " >> syslog/lplog$i
	    touch syslog/last_restart
	    echo -n "Restart $i. " >> syslog/last_restart
	    mv lplog syslog/lplogprev
	    ln syslog/lplog$i lplog
	    date >> syslog/lplog$i
	    rm LP_SWAP.3.`hostname`.* >> syslog/lplog$i
	    /u/jacob/mud/bin/driver 3011 -u2501 -DGENESIS >>& syslog/lplog$i
	    if ($status == 0) then
	       cp syslog/KEEPERSAVE.o syslog/backup/KEEPERSAVE_BACKUP.o.$i
	    endif
	    echo "Exit status: " $status >> syslog/lplog$i
	end
end