diff options
author | Michael Janczyk | 2012-12-11 17:20:53 +0100 |
---|---|---|
committer | Michael Janczyk | 2012-12-11 17:20:53 +0100 |
commit | e66413628d95f8c9d91a2080768501946c0d5514 (patch) | |
tree | 01f729a3327b5a21f2a123f3b783faadd91e86dc /src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh | |
parent | Added missing plugin files for RHEL, Scientific Linux and CentOS Linux. (diff) | |
download | core-e66413628d95f8c9d91a2080768501946c0d5514.tar.gz core-e66413628d95f8c9d91a2080768501946c0d5514.tar.xz core-e66413628d95f8c9d91a2080768501946c0d5514.zip |
sysrqshutdown plugin changed.
now there is a second script which does the sysrq requests which is started with nohup, so that one can logout from ssh first
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 + |