forked from github/server
34 lines
900 B
Bash
Executable File
34 lines
900 B
Bash
Executable File
#!/bin/bash
|
|
GAME=$1
|
|
BIN=$HOME/bin
|
|
export ERESSEA=$HOME/eressea
|
|
TURN=$(cat $ERESSEA/game-$GAME/turn)
|
|
if [ ! -e $ERESSEA/game-$GAME/data/$TURN.dat ]; then
|
|
echo "data file $TURN is missing, cannot run turn for game $GAME"
|
|
exit 1
|
|
fi
|
|
REPORTS=$ERESSEA/game-$GAME/reports
|
|
if [ -d $REPORTS ]; then
|
|
rm -rf $REPORTS
|
|
fi
|
|
mkdir $REPORTS
|
|
$BIN/backup-eressea $GAME
|
|
$BIN/run-turn $GAME
|
|
if [ ! -s $ERESSEA/game-$GAME/orders.$TURN ]; then
|
|
echo "server did not create orders for turn $TURN in game $GAME"
|
|
exit 2
|
|
fi
|
|
let TURN=$TURN+1
|
|
if [ ! -s $ERESSEA/game-$GAME/data/$TURN.dat ]; then
|
|
echo "server did not create data for turn $TURN in game $GAME"
|
|
exit 3
|
|
fi
|
|
if [ ! -s $REPORTS/reports.txt ]; then
|
|
echo "server did not create reports.txt for turn $TURN in game $GAME"
|
|
exit 4
|
|
fi
|
|
$BIN/compress.sh $GAME $TURN
|
|
$BIN/sendreports.sh $GAME
|
|
$BIN/backup-eressea $GAME
|
|
[ $GAME -lt 4 ] && $BIN/send-summary $GAME
|