diff options
author | Simon Rettberg | 2019-05-13 17:07:07 +0200 |
---|---|---|
committer | Simon Rettberg | 2019-05-13 17:07:07 +0200 |
commit | fbd004f55540676bec1716d4b9757e67e59f11bb (patch) | |
tree | 3506993530efffa20967f25ea64a2a718a6aad53 /core | |
parent | [idleaction] Fix .service file (diff) | |
download | mltk-fbd004f55540676bec1716d4b9757e67e59f11bb.tar.gz mltk-fbd004f55540676bec1716d4b9757e67e59f11bb.tar.xz mltk-fbd004f55540676bec1716d4b9757e67e59f11bb.zip |
[idleaction] Refine exam mode shutdown/reboot timing
Keep existing schedule entries (we have --min-idle 7200) but add entries
for 23:00 and 4:00 to non-empty schedules. We might skip a tightly
scheduled entry due to --min-idle, e.g. an exam lasts until 19:30 and
the schedule says poweroff at 20:00. We'll miss that entry if the user
didn't log out before, since two hours didn't pass yet.
If the schedule was empty however, do nothing, since it might be desired
that the machines keep running until they die.
Diffstat (limited to 'core')
-rwxr-xr-x | core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher b/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher index c2fcce78..3f20ca5e 100755 --- a/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher +++ b/core/modules/idleaction/data/opt/openslx/scripts/idle-daemon-launcher @@ -14,22 +14,23 @@ if [ -z "${SLX_EXAM}" ]; then [ -n "$SLX_SCREEN_SAVER_TIMEOUT" ] && CMD="$CMD --screensaver-timeout $SLX_SCREEN_SAVER_TIMEOUT" [ -n "$SLX_SCREEN_STANDBY_TIMEOUT" ] && CMD="$CMD --dpms-timeout $SLX_SCREEN_STANDBY_TIMEOUT" [ -n "$SLX_SCREEN_SAVER_GRACE_TIME" ] && CMD="$CMD --grace-period $SLX_SCREEN_SAVER_GRACE_TIME" - - for t in $SLX_REBOOT_SCHEDULE; do - CMD="$CMD --reboot $t" - done - for t in $SLX_SHUTDOWN_SCHEDULE; do - CMD="$CMD --poweroff $t" - done else # Exam mode active CMD="$CMD --min-idle 7200" # Ignore schedule if idle time is lower than 2h + # Add additional times -- We might miss tightly scheduled ones because of --min-idle if [ -n "$SLX_SHUTDOWN_SCHEDULE" ]; then - CMD="$CMD --poweroff 22:00 4:00" + SLX_SHUTDOWN_SCHEDULE="$SLX_SHUTDOWN_SCHEDULE 23:00 4:00" elif [ -n "$SLX_REBOOT_SCHEDULE" ]; then - CMD="$CMD --reboot 22:00 4:00" + SLX_REBOOT_SCHEDULE="$SLX_REBOOT_SCHEDULE 23:00 4:00" fi fi +for t in $SLX_REBOOT_SCHEDULE; do + CMD="$CMD --reboot $t" +done +for t in $SLX_SHUTDOWN_SCHEDULE; do + CMD="$CMD --poweroff $t" +done + exec /opt/openslx/sbin/idle-daemon $CMD |