#!/bin/csh

set binpath = /home/damien/FFTacticsMUD/bin
set port = 1234

cd $binpath

if ( -e shutdown.txt ) rm -f shutdown.txt

while(1)
    set index = 1000
    while(1)
	set logfile = ../log/$index.log
	if( ! -e $logfile ) break
	@ index++
    end

    ./FFTacticsMUD_exe $port >&! $logfile

    if ( -e shutdown.txt ) then
	rm -f shutdown.txt
	exit 0
    endif
    sleep 5
end