#!/bin/csh -f
#
#usage: restart <port>
# You will need to change this
set GAMEDIR = game
set INDB = indb.Z
set OUTDB = outdb.Z
set LOG = netmush.log
set mush = `/bin/ps ux | /bin/grep netmush | /usr/ucb/wc -l`
# Uncomment the following only if you are RUNNING an RWHO server and want to
# restart it as well
#set mwhod = `/bin/ps ux | /bin/grep mwhod | /usr/ucb/wc -l`
cd $GAMEDIR
#define Uncomment to following only to restart the RWHO server
#if ($mwhod == 1) then
# echo restarting mud who daemon
# (./mwhod -f muds.dat -n FooWHO >& mwhod.log &)
#endif
if ($mush > 1) then
echo Mush already active.
exit 0
endif
echo Restarting Mush.
if (-r data/$OUTDB.PANIC) then
set end = "`tail -1 data/$OUTDB.PANIC`"
if ("$end" == "***END OF DUMP***" ) then
mv data/$OUTDB.PANIC data/temp
compress data/temp
mv data/temp.Z data/$OUTDB
else
rm data/$OUTDB.PANIC
echo "Warning: PANIC dump corrupt using older db."
endif
endif
rm -f save/$INDB.old
mv -f data/$INDB save/$INDB.old
rm -f $LOG
if (-r data/$OUTDB) then
mv data/$OUTDB data/$INDB
else
cp save/$INDB.old data/$INDB
endif
(../netmush data/$INDB data/$OUTDB $1 >& $LOG &)