diff options
| author | Simon Rettberg | 2016-01-14 00:05:18 +0100 |
|---|---|---|
| committer | Simon Rettberg | 2016-01-14 00:05:18 +0100 |
| commit | 9c14140ec9d487aac7be949beabe957e9684959a (patch) | |
| tree | 0c64a2afe5b6f44d7f1cbda5d26674762a2b8de9 /remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script | |
| parent | [kdm*] Don't use hard reboot/poweroff as it's not necessary (diff) | |
| download | tm-scripts-9c14140ec9d487aac7be949beabe957e9684959a.tar.gz tm-scripts-9c14140ec9d487aac7be949beabe957e9684959a.tar.xz tm-scripts-9c14140ec9d487aac7be949beabe957e9684959a.zip | |
[idleaction] Warn user about scheduled reboot/poweroff and delay by 5 minutes
Diffstat (limited to 'remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script')
| -rwxr-xr-x | remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script index b0e67e4f..b7617940 100755 --- a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script +++ b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script @@ -29,7 +29,7 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ] && [ "${SLX_LOGOUT_TIMEOUT}" -gt 0 ]; then if [ -n "$DISPLAY" ]; then # Seems to be x11 IDLE= - export XAUTHORITY=$(ps a | grep -v grep | grep -o -- '-auth.*$' | awk '{print $2}') + export XAUTHORITY=$(ps a | grep " $DISPLAY " | grep -o -- '-auth.*$' | grep -m1 -v grep | awk '{print $2}') [ -n "$XAUTHORITY" ] && [ -f "$XAUTHORITY" ] && IDLE=$(xprintidle) # Now that we have DISPLAY and XAUTHORITY set, xprintidle should work if [ -z "$IDLE" ]; then @@ -122,7 +122,7 @@ if [ -n "$SLX_SHUTDOWN_SCHEDULE" -o -n "$SLX_REBOOT_SCHEDULE" ] && [ ! -e "$CRON [ -z "$HOUR$MINUTE" ] && invalid_time && continue [ "$HOUR" -lt 0 -o "$HOUR" -gt 23 ] && invalid_time && continue [ "$MINUTE" -lt 0 -o "$MINUTE" -gt 59 ] && invalid_time && continue - echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_poweroff" >> "$CRONFILE" + echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_action poweroff" >> "$CRONFILE" done # do it again for SLX_REBOOT_SCHEDULE for time in $SLX_REBOOT_SCHEDULE; do @@ -131,7 +131,7 @@ if [ -n "$SLX_SHUTDOWN_SCHEDULE" -o -n "$SLX_REBOOT_SCHEDULE" ] && [ ! -e "$CRON [ -z "$HOUR$MINUTE" ] && invalid_time && continue [ "$HOUR" -lt 0 -o "$HOUR" -gt 23 ] && invalid_time && continue [ "$MINUTE" -lt 0 -o "$MINUTE" -gt 59 ] && invalid_time && continue - echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_reboot" >> "$CRONFILE" + echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_action reboot" >> "$CRONFILE" done touch "/etc/cron.d" # Aufs bug where it won't update dir mtime when creating the file within fi |
