forked from github/server
29 lines
493 B
Bash
Executable file
29 lines
493 B
Bash
Executable file
#!/bin/bash
|
|
|
|
GAME=$1
|
|
TURN=$2
|
|
|
|
if [ ! -d "$ERESSEA/game-$GAME" ] ; then
|
|
echo "No such game: $GAME"
|
|
exit 1
|
|
fi
|
|
|
|
cd "$ERESSEA/game-$GAME" || exit
|
|
|
|
lockfile -r3 -l120 orders.queue.lock
|
|
if [ -d "orders.dir.$TURN" ]; then
|
|
echo "orders.dir.$TURN already exists"
|
|
exit
|
|
fi
|
|
rm -f "orders.$TURN"
|
|
|
|
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
|
|
|