player/a/
player/b/
player/c/
player/d/
player/e/
player/f/
player/g/
player/i/
player/j/
player/k/
player/m/
player/n/
player/r/
player/s/
player/v/
player/w/
player/x/
player/z/
player_fst/e/
player_fst/f/
player_fst/h/
player_fst/i/
player_fst/j/
player_fst/n/
player_fst/o/
player_fst/p/
player_fst/player/a/
player_fst/player/b/
player_fst/player/c/
player_fst/player/d/
player_fst/player/e/
player_fst/player/f/
player_fst/player/g/
player_fst/player/j/
player_fst/player/k/
player_fst/player/m/
player_fst/player/n/
player_fst/player/r/
player_fst/player/s/
player_fst/player/v/
player_fst/player/w/
player_fst/player/x/
player_fst/player/z/
player_fst/u/
player_fst/v/
player_fst/w/
player_fst/x/
#! /bin/sh

# grab the port number
port=3626
if [ "$1" != "" ]; then port=$1; fi

# set up
cd ../reports
if ( -e shutdown.txt ); then rm -f shutdown.txt; fi

cd ../area

# allow cores
ulimit -c 5
# stack limit
ulimit -s 100000

renice 0 -p $$

# loop indefinately
while :
do
  # find a logfile

  index=1000
  while :
  do
    logfile=../log/$index.log
    if [ ! -e $logfile ]; then break; fi
    let index=$index+1
  done

  # run the mud
  ../src/ack $port >$logfile 2>&1

  # shutdown?

cd ../reports

  if [ -e shutdown.txt ]; then
    echo "startup: shutting down" >>$logfile
    rm -f shutdown.txt
    exit 1
  fi

cd ../area
  
  # sleep, so if we fail on boot we don't get massive looping
  sleep 5
done