2018-06-03 21:02:59 +02:00
|
|
|
#!/bin/sh
|
2019-05-08 18:23:19 +02:00
|
|
|
# example: orders-accept 2 de < mail.txt
|
2016-02-11 11:08:51 +01:00
|
|
|
|
2019-05-08 18:23:19 +02:00
|
|
|
game="$1"
|
2019-06-10 20:42:43 +02:00
|
|
|
lang="$2"
|
2019-02-10 10:07:08 +01:00
|
|
|
|
2019-05-08 18:23:19 +02:00
|
|
|
[ -z "$ERESSEA" ] && ERESSEA="$HOME/eressea"
|
|
|
|
SCRIPT=$(readlink -f "$0")
|
|
|
|
BIN=$(dirname "$SCRIPT")
|
|
|
|
|
|
|
|
LOCKFILE="$ERESSEA/game-$game/orders.queue.lock"
|
|
|
|
set -e
|
|
|
|
trap 'rm -f "$LOCKFILE"' EXIT
|
|
|
|
|
|
|
|
cd "$ERESSEA/game-$game"
|
|
|
|
mkdir -p orders.dir
|
|
|
|
cd orders.dir
|
|
|
|
lockfile -r3 -l120 "$LOCKFILE"
|
|
|
|
eval "$(python "$BIN/accept-orders.py" "$@")"
|
2019-12-23 15:20:39 +01:00
|
|
|
if [ -e "$ACCEPT_FILE" ]
|
2019-05-08 18:23:19 +02:00
|
|
|
then
|
2019-12-23 15:20:39 +01:00
|
|
|
rm -f "$LOCKFILE"
|
|
|
|
filename=$(basename "$ACCEPT_FILE")
|
|
|
|
email="$ACCEPT_MAIL"
|
|
|
|
if [ -d "$ERESSEA/orders-php" ]
|
|
|
|
then
|
|
|
|
php "$ERESSEA/orders-php/cli.php" insert "$filename" "$lang" "$email"
|
|
|
|
fi
|
2019-05-08 18:23:19 +02:00
|
|
|
fi
|