From f83c3a9e9f77ba5454ef0e0b2be248fa3dfab290 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Fri, 15 Sep 2017 19:58:22 +0200 Subject: [PATCH] move orders.queue file (clever use of lockfile program) --- process/create-orders | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/process/create-orders b/process/create-orders index ff784f9aa..7ddbde92e 100755 --- a/process/create-orders +++ b/process/create-orders @@ -1,3 +1,5 @@ +#!/bin/bash + GAME=$1 TURN=$2 @@ -7,6 +9,7 @@ if [ ! -d $ERESSEA/game-$GAME ] ; then fi cd $ERESSEA/game-$GAME + if [ -d orders.dir.$TURN ]; then echo "orders.dir.$TURN already exists" else @@ -14,3 +17,11 @@ else mkdir -p orders.dir fi ls -1rt orders.dir.$TURN/turn-* | xargs cat > orders.$TURN + +if [ -e orders.queue ] ; then + lockfile -r3 -l120 orders.queue.lock + mv orders.queue orders.dir.$TURN/orders.queue + rm -f orders.queue.lock +fi + +