diff --git a/process/cron/orders.cron b/process/cron/orders.cron index dc060a5e1..7632ac844 100755 --- a/process/cron/orders.cron +++ b/process/cron/orders.cron @@ -14,9 +14,10 @@ if [ -z "$ERESSEA" ] ; then echo "The ERESSEA environment variable is not set. Assuming $ERESSEA." fi -cd $ERESSEA +cd "$ERESSEA" || exit -for GAME in $* +for GAME in "$@" do - orders-php/check-orders.sh $GAME + orders-php/check-orders.sh "$GAME" done + diff --git a/process/cron/preview.cron b/process/cron/preview.cron index 5192d0f5a..04869c2f2 100755 --- a/process/cron/preview.cron +++ b/process/cron/preview.cron @@ -3,7 +3,7 @@ [ "$PREVIEW" != "yes" ] && exit [ -z "${ERESSEA}" ] && ERESSEA="$HOME/eressea" -eval $(luarocks path) +eval "$(luarocks path)" branch="develop" if [ -e "${ERESSEA}/build/.preview" ]; then branch=$(cat "${ERESSEA}/build/.preview") diff --git a/process/cron/run-eressea.cron b/process/cron/run-eressea.cron index 32ad873df..aa3ed287b 100755 --- a/process/cron/run-eressea.cron +++ b/process/cron/run-eressea.cron @@ -1,55 +1,55 @@ #!/bin/bash -eval $(luarocks path) +eval "$(luarocks path)" GAME=$1 ( -[ "$ENABLED" != "yes" ] && exit -[ -z ${ERESSEA} ] && ERESSEA=$HOME/eressea +[ "$ENABLED" == "no" ] && exit +[ -z "$ERESSEA" ] && ERESSEA="$HOME/eressea" export ERESSEA -BIN=$ERESSEA/server/bin -TURN=$(cat $ERESSEA/game-$GAME/turn) -if [ ! -e $ERESSEA/game-$GAME/data/$TURN.dat ]; then +BIN="$ERESSEA/server/bin" +TURN=$(cat "$ERESSEA/game-$GAME/turn") +if [ ! -e "$ERESSEA/game-$GAME/data/$TURN.dat" ]; then echo "data file $TURN is missing, cannot run turn for game $GAME" exit 1 fi -REPORTS=$ERESSEA/game-$GAME/reports -if [ -d $REPORTS ]; then - rm -rf $REPORTS +REPORTS="$ERESSEA/game-$GAME/reports" +if [ -d "$REPORTS" ]; then + rm -rf "$REPORTS" fi -mkdir $REPORTS +mkdir "$REPORTS" -cd $ERESSEA/game-$GAME +cd "$ERESSEA/game-$GAME" || exit if [ -d test ]; then touch test/execute.lock fi -$BIN/create-orders $GAME $TURN -if [ ! -s $ERESSEA/game-$GAME/orders.$TURN ]; then +"$BIN/create-orders" "$GAME" "$TURN" +if [ ! -s "$ERESSEA/game-$GAME/orders.$TURN" ]; then echo "server did not create orders for turn $TURN in game $GAME" exit 2 fi -$BIN/backup-eressea $GAME $TURN +"$BIN/backup-eressea" "$GAME" "$TURN" rm -f execute.lock -$BIN/run-turn $GAME $TURN +"$BIN/run-turn" "$GAME" "$TURN" touch execute.lock -if [ ! -s $REPORTS/reports.txt ]; then +if [ ! -s "$REPORTS/reports.txt" ]; then echo "server did not create reports.txt in game $GAME" exit 4 fi -$BIN/backup-eressea $GAME $TURN +"$BIN/backup-eressea" "$GAME" "$TURN" let TURN=$TURN+1 -if [ ! -s $ERESSEA/game-$GAME/data/$TURN.dat ]; then +if [ ! -s "$ERESSEA/game-$GAME/data/$TURN.dat" ]; then echo "server did not create data for turn $TURN in game $GAME" exit 3 fi echo "sending reports for game $GAME, turn $TURN" -$BIN/compress.sh $GAME $TURN -$BIN/sendreports.sh $GAME -$BIN/backup-eressea $GAME $TURN +"$BIN/compress.sh" "$GAME" "$TURN" +"$BIN/sendreports.sh" "$GAME" +"$BIN/backup-eressea" "$GAME" "$TURN" rm -f test/execute.lock -) | tee -a $HOME/log/eressea.cron.log +) | tee -a "$HOME/log/eressea.cron.log" diff --git a/process/orders-process b/process/orders-process index 4751a94b1..d77b7fa2f 100755 --- a/process/orders-process +++ b/process/orders-process @@ -1,6 +1,7 @@ #!/bin/sh -SCRIPT=$(readlink -f $0) -cd $(dirname $SCRIPT) +SCRIPT=$(readlink -f "$0") +SCRDIR=$(dirname "$SCRIPT") +cd "$SCRDIR" || exit lockfile -r3 -l120 orders.queue.lock python process-orders.py "$@" diff --git a/process/received-mail.sh b/process/received-mail.sh deleted file mode 100644 index b6b4a0605..000000000 --- a/process/received-mail.sh +++ /dev/null @@ -1 +0,0 @@ -ls -1 orders.dir/turn* | sed -e 's/.*turn-\(.*\),gruenbaer.*/\1/' | sort -u diff --git a/process/received.sh b/process/received.sh deleted file mode 100644 index 9a0c4511d..000000000 --- a/process/received.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -grep -hiw ERESSEA orders.dir/turn-* | cut -d\ -f2 | sort -u