From bd25e34bc73a887f5f745c14fedb395bbe54c7a8 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Wed, 29 Nov 2017 22:09:26 +0100 Subject: [idleaction] Timing fixes --- .../idleaction/data/opt/openslx/scripts/idleaction-scheduled_action | 2 ++ .../modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'core/modules') diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action index 5e279c34..68920709 100755 --- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action +++ b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_action @@ -37,6 +37,8 @@ done if [ -n "$TS" ]; then # Sanity check for trigger by cron + # Sleep first so the clock has time to get adjusted + sleep 10 NOW=$(date +%s) SHOULD=$(date -d "today $TS" +%s) DIFF=$(( NOW - SHOULD )) diff --git a/core/modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init b/core/modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init index 304b4a63..7c3afa00 100755 --- a/core/modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init +++ b/core/modules/idleaction/data/opt/openslx/scripts/systemd-idleaction_init @@ -32,7 +32,7 @@ if [ -n "$SCHEDULE" ]; then TODAY=$(date +%Y-%m-%d) # Use tomorrow instead of adding 86400 seconds so it (hopefully) works when DST changes TOMORROW=$(date --date="+1 day" +%Y-%m-%d) - NOW=$(date --date="+1 minute" +%s) # don't wake up again immediately + NOW=$(date +%s) for t in $SCHEDULE; do HOUR=${t%%:*} MINUTE=${t##*:} -- cgit v1.2.3-55-g7522