#!/bin/sh # # Startmush - Kick off the netmush process. # PATH=/usr/ucb:/bin:/usr/bin:.; export PATH # . mush.config # # Make sure there isn't aready a MUSH running. # nmush=`ps ux | egrep netmush | wc -l` if [ $nmush -gt 1 ]; then exit 0 fi # # Make sure the indexes are up-to-date. # ./mkindx news.txt news.indx ./mkindx help.txt help.indx ./mkindx wizhelp.txt wizhelp.indx run=1 while [ $run -eq 1 ]; do # # Check for a panic dump. If there is one and it is good, copy # it on top of the last checkpoint DB written by mush. If it is bad, # just delete it. # if [ -r $CRASH_DB ]; then end="`tail -1 $CRASH_DB`" if [ "$end" = "***END OF DUMP***" ]; then mv $CRASH_DB $NEW_DB else rm $CRASH_DB echo "Warning: PANIC dump corrupt using older db." echo "Warning: PANIC dump failed on "`date` | mail $OWNER fi fi # # Save a copy of the previous input database and log. # if [ -r $INPUT_DB ]; then mv -f $INPUT_DB $SAVE_DB fi mv -f $LOGNAME $LOGNAME.old # # If we have a good checkpoint database, make it the input database. # If not, use the backup of the input database. # if [ -r $NEW_DB ]; then mv $NEW_DB $INPUT_DB else cp $SAVE_DB $INPUT_DB fi # # Kick off MUSH # (nohup ./netmush $GAMENAME.conf >$LOGNAME 2>&1) if [ "`cat shutdown.status`" = "norestart" ]; then run=0 fi done