autorun.sh
1 #!/bin/sh 2 # 3 # CircleMUD autorun script 4 # Contributions by Fred Merkel, Stuart Lamble, and Jeremy Elson 5 # Copyright (c) 1996 The Trustees of The Johns Hopkins University 6 # All Rights Reserved 7 # See license.doc for more information 8 # 9 ############################################################################# 10 # 11 # This script can be used to run CircleMUD over and over again (i.e., have it 12 # automatically reboot if it crashes). It will run the game, and copy some 13 # of the more useful information from the system logs to the 'log' directory 14 # for safe keeping. 15 # 16 # You can control the operation of this script by creating and deleting files 17 # in Circle's root directory, either manually or by using the 'shutdown' 18 # command from within the MUD. 19 # 20 # Creating a file called .fastboot makes the script wait only 5 seconds 21 # between reboot attempts instead of the usual 60. If you want a quick 22 # reboot, use the "shutdown reboot" command from within the MUD. 23 # 24 # Creating a file called .killscript makes the script terminate (i.e., stop 25 # rebooting the MUD). If you want to shut down the MUD and make it stay 26 # shut down, use the "shutdown die" command from within the MUD. 27 # 28 # Finally, if a file called pause exists, the script will not reboot the MUD 29 # again until pause is removed. This is useful if you want to turn the MUD 30 # off for a couple of minutes and then bring it back up without killing the 31 # script. Type "shutdown pause" from within the MUD to activate this feature. 32 # 33 34 # The port on which to run the MUD 35 PORT=4000 36 37 # Default flags to pass to the MUD server (see admin.txt for a description 38 # of all flags). 39 FLAGS='-q' 40 41 ############################################################################# 42 43 while ( : ) do 44 45 DATE=`date` 46 echo "autorun starting game $DATE" >> syslog 47 echo "running bin/circle $FLAGS $PORT" >> syslog 48 49 bin/circle $FLAGS $PORT >> syslog 2>&1 50 51 tail -30 syslog > syslog.CRASH 52 53 fgrep "self-delete" syslog >> log/delete 54 fgrep "death trap" syslog >> log/dts 55 fgrep "killed" syslog >> log/rip 56 fgrep "Running" syslog >> log/restarts 57 fgrep "advanced" syslog >> log/levels 58 fgrep "equipment lost" syslog >> log/rentgone 59 fgrep "usage" syslog >> log/usage 60 fgrep "new player" syslog >> log/newplayers 61 fgrep "SYSERR" syslog >> log/errors 62 fgrep "(GC)" syslog >> log/godcmds 63 fgrep "Bad PW" syslog >> log/badpws 64 65 rm log/syslog.1 66 mv log/syslog.2 log/syslog.1 67 mv log/syslog.3 log/syslog.2 68 mv log/syslog.4 log/syslog.3 69 mv log/syslog.5 log/syslog.4 70 mv log/syslog.6 log/syslog.5 71 mv syslog log/syslog.6 72 touch syslog 73 74 if [ -r .killscript ]; then 75 DATE=`date`; 76 echo "autoscript killed $DATE" >> syslog 77 rm .killscript 78 exit 79 fi 80 81 if [ ! -r .fastboot ]; then 82 sleep 60 83 else 84 rm .fastboot 85 sleep 5 86 fi 87 88 while [ -r pause ]; do 89 sleep 60 90 done 91 92 done