diff options
| author | Jonathan Bauer | 2016-01-22 17:35:14 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2016-01-22 17:35:14 +0100 |
| commit | f595907fa79e5eabd4e18766c87a094acd4e4ee4 (patch) | |
| tree | b6787af2c28da63e8990ea005bbd93e106fd7f3c /remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script | |
| parent | [pvs] remove hardcoded name to pvs session. Instead check for the name in the... (diff) | |
| parent | [vmchooser2] Add support for new location related parameters (diff) | |
| download | tm-scripts-f595907fa79e5eabd4e18766c87a094acd4e4ee4.tar.gz tm-scripts-f595907fa79e5eabd4e18766c87a094acd4e4ee4.tar.xz tm-scripts-f595907fa79e5eabd4e18766c87a094acd4e4ee4.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
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 | 13 |
1 files changed, 5 insertions, 8 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 9a9bdf1c..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 @@ -95,7 +95,7 @@ if [ -n "${SLX_SHUTDOWN_TIMEOUT}" ] && [ "${SLX_SHUTDOWN_TIMEOUT}" -gt 0 ] && [ [ "$IDLE" -gt "$NOW" ] && IDLE="$NOW" IDLE=$(( $NOW - $IDLE )) if [ "$IDLE" -gt "$SLX_SHUTDOWN_TIMEOUT" ]; then - poweroff -nf # TODO: Do proper shutdown once it works reliably + poweroff fi fi @@ -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,11 +131,8 @@ 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 - ( - sleep 20 - systemctl restart cron - ) & + touch "/etc/cron.d" # Aufs bug where it won't update dir mtime when creating the file within fi |
