summaryrefslogtreecommitdiffstats
path: root/core/modules/idleaction
diff options
context:
space:
mode:
authorSimon Rettberg2018-10-12 13:32:31 +0200
committerSimon Rettberg2018-10-12 13:32:31 +0200
commitf039ac6c65204b34f21cba4cee5181ee81e7eb4d (patch)
tree4c1d50158cdd1e74f5c79041e3f5a7c61339234c /core/modules/idleaction
parent[xscreensaver] Fix: DPMS always disabled (wrong variable accessed) (diff)
downloadmltk-f039ac6c65204b34f21cba4cee5181ee81e7eb4d.tar.gz
mltk-f039ac6c65204b34f21cba4cee5181ee81e7eb4d.tar.xz
mltk-f039ac6c65204b34f21cba4cee5181ee81e7eb4d.zip
[idleaction] Account for 5 minute delay when calculating shutdown
The screensaver info is off by 5 minutes for reboot/shutdown, since there's an additional delay of 5 minutes if someone's logged in. Always add those 5 minutes, since the message will only ever be seen if someone is actually logged in.
Diffstat (limited to 'core/modules/idleaction')
-rwxr-xr-xcore/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
index baa6a662..33a64cdb 100755
--- a/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
+++ b/core/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script
@@ -28,7 +28,12 @@ gen_runfile() {
dateline=
for i in $SLX_REBOOT_SCHEDULE $SLX_SHUTDOWN_SCHEDULE; do
ts=$(date -d "today $i" +%s)
- [ "$ts" -gt "$NOW" ] || ts=$(date -d "tomorrow $i" +%s)
+ [ "$ts" -gt 0 ] || continue # NaN
+ ts=$(( ts + 300 )) # Account for the 5 minute delay if someone is logged in
+ if [ "$ts" -lt "$NOW" ]; then
+ ts=$(date -d "tomorrow $i" +%s)
+ ts=$(( ts + 300 )) # Account for the 5 minute delay if someone is logged in
+ fi
[ "$ts" -gt "$NOW" ] || continue
if [ -z "$dateline" ] || [ "$ts" -lt "$dateline" ]; then
dateline="$ts"