#!/bin/csh -f
#
# Sole argument is a port number, if desired,
# if none is given defaults to 6250.
#
set GAMEDIR = game
set muck = `ps aux | grep netmuck | wc -l`
if ($muck > 1) exit 0
cd $GAMEDIR
if (-r small.db.new.PANIC) then
set end = "`tail -1 small.db.new.PANIC`"
if ("$end" == "***END OF DUMP***" ) then
/bin/mv small.db.new.PANIC small.db.new
else
/bin/rm small.db.new.PANIC
/bin/echo "Warning: PANIC dump failed on "`date`
endif
endif
if !(-r small.db) then
cp -f ../small.db small.db
endif
mv -f small.db small.db.old
if (-r small.db.new) then
mv small.db.new small.db
else
cp small.db.old small.db
endif
../netmuck small.db small.db.new $1 >& small.log &