ackfuss-4.3.9/area/
ackfuss-4.3.9/board/
ackfuss-4.3.9/help/e/
ackfuss-4.3.9/help/f/
ackfuss-4.3.9/help/h/
ackfuss-4.3.9/help/l/
ackfuss-4.3.9/help/n/
ackfuss-4.3.9/help/q/
ackfuss-4.3.9/help/s/
ackfuss-4.3.9/help/u/
ackfuss-4.3.9/help/v/
ackfuss-4.3.9/help/y/
ackfuss-4.3.9/help/z/
ackfuss-4.3.9/npc/a/
ackfuss-4.3.9/npc/b/
ackfuss-4.3.9/npc/c/
ackfuss-4.3.9/npc/d/
ackfuss-4.3.9/npc/e/
ackfuss-4.3.9/npc/f/
ackfuss-4.3.9/npc/h/
ackfuss-4.3.9/npc/i/
ackfuss-4.3.9/npc/k/
ackfuss-4.3.9/npc/l/
ackfuss-4.3.9/npc/n/
ackfuss-4.3.9/npc/o/
ackfuss-4.3.9/npc/p/
ackfuss-4.3.9/npc/r/
ackfuss-4.3.9/npc/s/
ackfuss-4.3.9/npc/w/
ackfuss-4.3.9/player/c/
#!/bin/sh
#
# /bin/sh replacement for startup, by Spectrum
#

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

# set up
cd ../report
if [ -f shutdown.txt ]; then rm -f shutdown.txt; fi

cd ../area

# allow cores
#ulimit -c 50000
# stack limit
#ulimit -s 1500

renice +5 -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

  date > $logfile

  # run the mud
  matches=`netstat -an | grep ":$port " | grep -c LISTEN`
  if [ $matches -ge 1 ]; then
    #Already running
    echo Port $port already in use.
    exit 0
  fi
  ../src/ack $port &> $logfile

  # shutdown?

cd ../report

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

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