/bin/csh -f
set port = 9000
if ( "$1"!= "") set port="$1"
cd ../area
nohup
nice
limit stack 1024k
ulimit -Sc unlimited
if ( -e shutdown.txt ) rm -f shutdown.txt
while ( 1 )
/log/syslog.9
if ( -e ../log/syslog.9 ) then
set index = 1000
while ( 1 )
set archivefile = ../log/archived/$index.log
if ( ! -e $archivefile ) break
@ index++
end
mv ../log/syslog.9 $archivefile
endif
mv ../log/syslog.8 ../log/syslog.9
mv ../log/syslog.7 ../log/syslog.8
mv ../log/syslog.6 ../log/syslog.7
mv ../log/syslog.5 ../log/syslog.6
mv ../log/syslog.4 ../log/syslog.5
mv ../log/syslog.3 ../log/syslog.4
mv ../log/syslog.2 ../log/syslog.3
mv ../log/syslog.1 ../log/syslog.2
mv ../log/syslog.log   ../log/syslog.1
/log/syslog.log
cd ../../
mv backup/dbsbackup.current.tar.gz backup/dbsbackup.previous.tar.gz
tar -czf backup/dbsbackup.current.tar.gz -X backup/exclude.list ./dbs
cd dbs/area
cp ../system/hiscores.dat ../system/hiscores.bak
set logfile = ../log/syslog.log
date > $logfile
date > ../area/boot.txt
../src/dbsaga 9000 >&! $logfile
/src/smaug 7654 >&! $logfile
/src/smaug $port >&! $logfile
/src/smaug >>&! $logfile
if ( -e core ) then
set index = 1000
while ( 1 )
set crashfile = ../crash/$index.crash
if ( ! -e $crashfile ) break
@ index++
end
\mv core ../src
cd ../src
date > $crashfile
gdb -batch -x commands dbsaga core >> $crashfile
/crash/core.$index
rm -f core
cd ../area
endif
if ( -e shutdown.txt ) then
rm -f shutdown.txt
exit 0
endif
sleep 10
end
