summaryrefslogtreecommitdiff
path: root/scripts/autorun.sh
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2022-03-24 14:47:23 +0100
committeremkael <emkael@tlen.pl>2022-03-24 14:47:23 +0100
commita6f599c270a786690c51f2e92537f33380e28cfe (patch)
tree8952e1e8ad7aecfb9a1646e23968a49347aa1d48 /scripts/autorun.sh
parent1da0fcd26025cf1dd94571d5bcf0be845d00e323 (diff)
Auto-run playoff generator now fires if the brackets were running in the previous 12 hours
Diffstat (limited to 'scripts/autorun.sh')
-rwxr-xr-xscripts/autorun.sh7
1 files changed, 6 insertions, 1 deletions
diff --git a/scripts/autorun.sh b/scripts/autorun.sh
index c2da400..fef934d 100755
--- a/scripts/autorun.sh
+++ b/scripts/autorun.sh
@@ -1,12 +1,17 @@
#!/bin/bash
+set -u
export GIT_SSH_COMMAND="ssh ${LIGA_SSH_OPTS}"
FORCE=${1:-0}
+RUNNING_INDICATOR=${LIGA_PLAYOFF_LOGFILE}.running
+
+find ${RUNNING_INDICATOR} -mtime +0.5 -delete # if the bracket is not running for 12 hours, it's running
PREVHEAD=$(git rev-parse HEAD)
git pull --quiet --rebase --autostash --recurse-submodules --no-stat
-if [ -n "$(git diff --name-status --no-renames $PREVHEAD HEAD)" -o $FORCE != "0" ]
+if [ -n "$(git diff --name-status --no-renames $PREVHEAD HEAD)" -o $FORCE != "0" -o -f ${RUNNING_INDICATOR} ]
then
( date --rfc-3339=seconds; ./generate.sh; ./sync.sh; date --rfc-3339=seconds; ) > ${LIGA_PLAYOFF_LOGFILE} 2>&1
+ (grep 'phase object' ${LIGA_PLAYOFF_LOGFILE} | grep -v 'not running') && touch ${RUNNING_INDICATOR}
fi