From 10b4723d9f72a668d0e84c730f9edf3eec5076f6 Mon Sep 17 00:00:00 2001 From: Neale Pickett Date: Sun, 28 Jan 2018 10:24:49 -0700 Subject: [PATCH] Look for "until" file to disable contest by time --- bin/once | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/bin/once b/bin/once index 03e7f76..388ba21 100755 --- a/bin/once +++ b/bin/once @@ -17,6 +17,17 @@ if [ -f state/disabled ]; then exit fi +# Are we stopping at a certain time? +if [ -f state/until ]; then + read -r until < state/until + when=$(date -d "$until" +%s) + now=$(date +%s) + if [ $now -ge $when ]; then + log "End time reached; doing nothing" + exit + fi +fi + # Reset to initial state? if [ ! -f state/initialized ]; then log "Resetting contest state"