server/process/create-orders

25 lines
378 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
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