2017-09-15 19:58:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-01-11 01:23:47 +01:00
|
|
|
GAME=$1
|
|
|
|
TURN=$2
|
|
|
|
|
|
|
|
if [ ! -d $ERESSEA/game-$GAME ] ; then
|
|
|
|
echo "No such game: $GAME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
cd $ERESSEA/game-$GAME
|
2017-09-15 19:58:22 +02:00
|
|
|
|
2015-01-11 01:23:47 +01:00
|
|
|
if [ -d orders.dir.$TURN ]; then
|
|
|
|
echo "orders.dir.$TURN already exists"
|
|
|
|
else
|
|
|
|
mv orders.dir orders.dir.$TURN
|
|
|
|
mkdir -p orders.dir
|
|
|
|
fi
|
|
|
|
ls -1rt orders.dir.$TURN/turn-* | xargs cat > orders.$TURN
|
2017-09-15 19:58:22 +02:00
|
|
|
|
2017-09-15 19:59:42 +02:00
|
|
|
lockfile -r3 -l120 orders.queue.lock
|
2017-09-15 19:58:22 +02:00
|
|
|
if [ -e orders.queue ] ; then
|
|
|
|
mv orders.queue orders.dir.$TURN/orders.queue
|
2017-09-15 19:59:42 +02:00
|
|
|
fi
|
|
|
|
rm -f orders.queue.lock
|
2017-09-15 19:58:22 +02:00
|
|
|
fi
|
|
|
|
|
|
|
|
|