2017-09-15 19:58:22 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2015-01-11 01:23:47 +01:00
|
|
|
GAME=$1
|
|
|
|
TURN=$2
|
|
|
|
|
2017-12-03 17:30:41 +01:00
|
|
|
if [ ! -d "$ERESSEA/game-$GAME" ] ; then
|
2015-01-11 01:23:47 +01:00
|
|
|
echo "No such game: $GAME"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2017-12-03 17:30:41 +01:00
|
|
|
cd "$ERESSEA/game-$GAME" || exit
|
2017-09-15 19:58:22 +02:00
|
|
|
|
2020-06-27 21:42:33 +02:00
|
|
|
lockfile -r3 -l120 orders.queue.lock
|
2017-12-03 17:30:41 +01:00
|
|
|
if [ -d "orders.dir.$TURN" ]; then
|
2015-01-11 01:23:47 +01:00
|
|
|
echo "orders.dir.$TURN already exists"
|
2020-06-27 21:42:33 +02:00
|
|
|
exit
|
2015-01-11 01:23:47 +01:00
|
|
|
fi
|
2020-06-26 21:58:30 +02:00
|
|
|
rm -f "orders.$TURN"
|
2017-09-15 19:58:22 +02:00
|
|
|
|
2020-06-27 21:42:33 +02:00
|
|
|
cd orders.dir || exit
|
|
|
|
|
|
|
|
php ../../orders-php/cli.php -d "orders.db" export | tr -d '\r' > "../orders.$TURN"
|
|
|
|
|
|
|
|
cd .. || exit
|
|
|
|
mv orders.dir "orders.dir.$TURN"
|
|
|
|
mkdir -p orders.dir
|
|
|
|
|
|
|
|
rm -f orders.queue.lock
|
2017-09-15 19:58:22 +02:00
|
|
|
|