mindor/area/
mindor/data/
mindor/data/bank/
mindor/data/hometown/
mindor/log/
mindor/player/
#!/usr/bin/tcsh

set areapath = /home/mcbride/mindor/area
set port = 4060
set wwwport = 4061

cd $areapath

# Set limits.
if ( -e shutdown.txt ) rm -f shutdown.txt

while ( 1 )
    # If you want to have logs in a different directory,
    #   change the 'set logfile' line to reflect the directory name.
    set index = 1000
    while ( 1 )
	set logfile = ../log/$index.log
	if ( ! -e $logfile ) break
	@ index++
    end

    # Copy rot binary from bin directory.
    # after a compile, place the new binary in the bin directory,
    # this way a reboot will install the new binary, instead of
    # of having to shut down.
    rm -f ./mindor
    cp ../src/mindor .
    # Run mindor .
    ./mindor $port $wwwport >&! $logfile

    # Restart, giving old connections a chance to die.
    sleep 15
end