forked from github/server
26 lines
581 B
Bash
Executable file
26 lines
581 B
Bash
Executable file
#!/bin/sh
|
|
# example: orders-accept 2 de < mail.txt
|
|
|
|
game="$1"
|
|
lang="$2"
|
|
|
|
[ -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" "$@")"
|
|
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
|