/
roa/
roa/lib/boards/
roa/lib/config/
roa/lib/edits/
roa/lib/help/
roa/lib/misc/
roa/lib/plrobjs/
roa/lib/quests/
roa/lib/socials/
roa/lib/www/
roa/lib/www/LEDSign/
roa/lib/www/LEDSign/fonts/
roa/lib/www/LEDSign/scripts/
roa/src/s_inc/
roa/src/sclient/
roa/src/sclient/binary/
roa/src/sclient/text/
roa/src/util/
#!/bin/csh -f
#
# CircleMUD 2.0 autorun script
# Originally by Fred C. Merkel
# Copyright (c) 1993 The Trustees of The Johns Hopkins University
# All Rights Reserved
# See license.doc for more information
#
# RoAMUD v1.0 autorun script
# Originally by Fred C. Merkel
# Modifications by James Rhone
# All Rights Reserved

# If .fastboot exists, the script will sleep for only 5 seconds between reboot
# attempts.  If .killscript exists, the script commit suicide (and remove
# .killscript).  If pause exists, the script will repeatedly sleep for
# 30 seconds and will not restart the mud until pause is removed.

# make sure you have run the setup script first...
if (! -f ./.setup_complete ) then
  echo "WARNING: Unable to run autorun, run setup_roa first..."
  exit
endif

set PORT = _DEF_PORT_
set FLAGS = ''

while (1)

  set DATE = (`date`);
  echo "autoscript starting game ${DATE}" >> syslog

  bin/roa $FLAGS $PORT >>& syslog

  fgrep "self-delete" syslog >> log/delete
  fgrep "death trap" syslog >> log/dts
  fgrep "killed" syslog >> log/rip
  fgrep "Running" syslog >> log/restarts
  fgrep "advanced" syslog >> log/levels
  fgrep "usage" syslog >> log/usage
  fgrep "new player" syslog >> log/newplayers
  fgrep "Bad PW" syslog >> log/badpws

  fgrep "SYSERR" syslog >> log/errors
  fgrep "editted" syslog >> log/editted
  fgrep "locked" syslog >> log/zonelocks

# make a notice, send it to ppl
  set DATE = (`date`);
  echo "RoA downtime notification, ${DATE}...." > ./sysmail
  echo "This is only a notification :) do not reply." >> ./sysmail
  echo " " >> ./sysmail

# if you have a mailing list, add it here perhaps

# send me a mail, with last 20 syslogs and date down
  tail -n 20 syslog >> ./sysmail
  fastmail ./sysmail _ADMIN_USERNAME_
  rm -f ./sysmail

  rm log/syslog.0
  mv log/syslog.1 log/syslog.0
  mv log/syslog.2 log/syslog.1
  mv log/syslog.3 log/syslog.2
  mv log/syslog.4 log/syslog.3
  mv log/syslog.5 log/syslog.4
  mv log/syslog.6 log/syslog.5
  mv log/syslog.7 log/syslog.6
  mv log/syslog.8 log/syslog.7
  mv log/syslog.9 log/syslog.8
  mv syslog       log/syslog.9
  touch syslog

  if (! -f .fastboot) then
    sleep 30
  else
    rm .fastboot
    sleep 5
  endif

  if (-f .killscript) then
    set DATE = (`date`);
    echo "autoscript killed $DATE "  >> syslog
    rm .killscript
    exit
  endif 

  # if the "pause" file exists, we'll keep sleeping
  while (-f pause) 
    sleep 50
  end

end