diff options
| author | Michael Pereira Neves | 2014-03-31 21:14:19 +0200 |
|---|---|---|
| committer | Michael Pereira Neves | 2014-03-31 21:14:19 +0200 |
| commit | c68cfbfde55cf8565ba186dd60f2065e2269650a (patch) | |
| tree | 6dbe7a31e0d943c968fad644f653effc903ae9b7 /remote/modules/idleaction | |
| parent | [brazilian] add brazilian locale and keymaps (diff) | |
| parent | [vbox] re-set permissions: openslx/script entries (diff) | |
| download | tm-scripts-c68cfbfde55cf8565ba186dd60f2065e2269650a.tar.gz tm-scripts-c68cfbfde55cf8565ba186dd60f2065e2269650a.tar.xz tm-scripts-c68cfbfde55cf8565ba186dd60f2065e2269650a.zip | |
Merge branch 'master' of git.openslx.org:openslx-ng/tm-scripts
Diffstat (limited to 'remote/modules/idleaction')
| -rwxr-xr-x | remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script | 13 | ||||
| -rwxr-xr-x | remote/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_reboot | 6 | ||||
| -rw-r--r-- | remote/modules/idleaction/module.build (renamed from remote/modules/idleaction/idleaction.build) | 0 | ||||
| -rw-r--r-- | remote/modules/idleaction/module.conf (renamed from remote/modules/idleaction/idleaction.conf) | 0 | ||||
| -rw-r--r-- | remote/modules/idleaction/module.conf.opensuse (renamed from remote/modules/idleaction/idleaction.conf.opensuse) | 0 | ||||
| -rw-r--r-- | remote/modules/idleaction/module.conf.ubuntu (renamed from remote/modules/idleaction/idleaction.conf.ubuntu) | 0 |
6 files changed, 18 insertions, 1 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 746f2f47..b68c27f8 100755 --- a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script +++ b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-cron_script @@ -39,6 +39,8 @@ if [ -n "${SLX_LOGOUT_TIMEOUT}" ]; then else loginctl terminate-session "$ses" fi + else # xprintidle did not work + IS_IDLE=no fi continue # Done with this session, skip normal tty/ssh checks fi @@ -103,7 +105,7 @@ invalid_time () return 0 } -if [ -n "$SLX_SHUTDOWN_SCHEDULE" ] && [ ! -e "$CRONFILE" ]; then +if [ -n "$SLX_SHUTDOWN_SCHEDULE" -o -n "$SLX_REBOOT_SCHEDULE" ] && [ ! -e "$CRONFILE" ]; then echo "# OpenSLX: Trigger poweroff at certain time of day" > "$CRONFILE" echo "SHELL=/bin/ash" >> "$CRONFILE" echo "PATH=/usr/sbin:/usr/bin:/sbin:/bin:/opt/openslx/usr/sbin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/bin" >> "$CRONFILE" @@ -116,5 +118,14 @@ if [ -n "$SLX_SHUTDOWN_SCHEDULE" ] && [ ! -e "$CRONFILE" ]; then [ "$MINUTE" -lt 0 -o "$MINUTE" -gt 59 ] && invalid_time && continue echo "$MINUTE $HOUR * * * root /opt/openslx/scripts/idleaction-scheduled_poweroff" >> "$CRONFILE" done + # do it again for SLX_REBOOT_SCHEDULE + for time in $SLX_REBOOT_SCHEDULE; do + HOUR=${time%%:*} + MINUTE=${time##*:} + [ -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" + done fi diff --git a/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_reboot b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_reboot new file mode 100755 index 00000000..fa3adf65 --- /dev/null +++ b/remote/modules/idleaction/data/opt/openslx/scripts/idleaction-scheduled_reboot @@ -0,0 +1,6 @@ +#!/bin/ash + +# TODO: Warn user, wait 5 minutes, etc... + +echo 'b' > /proc/sysrq-trigger + diff --git a/remote/modules/idleaction/idleaction.build b/remote/modules/idleaction/module.build index 1b740aa1..1b740aa1 100644 --- a/remote/modules/idleaction/idleaction.build +++ b/remote/modules/idleaction/module.build diff --git a/remote/modules/idleaction/idleaction.conf b/remote/modules/idleaction/module.conf index 1661735b..1661735b 100644 --- a/remote/modules/idleaction/idleaction.conf +++ b/remote/modules/idleaction/module.conf diff --git a/remote/modules/idleaction/idleaction.conf.opensuse b/remote/modules/idleaction/module.conf.opensuse index d368cbd8..d368cbd8 100644 --- a/remote/modules/idleaction/idleaction.conf.opensuse +++ b/remote/modules/idleaction/module.conf.opensuse diff --git a/remote/modules/idleaction/idleaction.conf.ubuntu b/remote/modules/idleaction/module.conf.ubuntu index 0dad2e48..0dad2e48 100644 --- a/remote/modules/idleaction/idleaction.conf.ubuntu +++ b/remote/modules/idleaction/module.conf.ubuntu |
