diff options
author | Dirk | 2012-12-15 00:57:08 +0100 |
---|---|---|
committer | Dirk | 2012-12-15 00:57:08 +0100 |
commit | 47e090aeb770bb53e7bd42d4742cf5b85ad54080 (patch) | |
tree | 23deaab88599bd2b55141f313b6ff05144956f14 /src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh | |
parent | ... (diff) | |
parent | FW is now automatically added to the initramfs. Checks are done with modinfo. (diff) | |
download | core-47e090aeb770bb53e7bd42d4742cf5b85ad54080.tar.gz core-47e090aeb770bb53e7bd42d4742cf5b85ad54080.tar.xz core-47e090aeb770bb53e7bd42d4742cf5b85ad54080.zip |
Merge branch 'master' of git.openslx.org:openslx/core
Diffstat (limited to 'src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh')
-rw-r--r-- | src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh b/src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh new file mode 100644 index 00000000..7e575ed3 --- /dev/null +++ b/src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Copyright (c) 2010 - RZ Uni FR +# Copyright (c) 2010 - 2012 OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# sysrqshutdown.sh +# - Script for SYSRQ shutdown +################################################################################ + +# check if reboot or halt, else use orig shutdown +if echo "$@" | grep -qe '-r now' + then + echo "Rebooting $(hostname) (sysrq)!" + rq_opt="b" +elif echo "$@" | grep -qe '-h now' + then + echo "Shutting down $(hostname) (sysrq)!" + rq_opt="o" +else + shutdown.slxorig $@ & + exit 0 +fi + +echo s >/proc/sysrq-trigger +sleep 1 +echo u >/proc/sysrq-trigger +(sleep 3 >/dev/null; echo ${rq_opt} >/proc/sysrq-trigger) & +killall sshd >/dev/null 2>&1 + +exit 0 + |