diff options
author | Michael Janczyk | 2010-07-23 22:13:39 +0200 |
---|---|---|
committer | Michael Janczyk | 2010-07-23 22:13:39 +0200 |
commit | 5063f565d886884e84234e31c2290ecddd7b6f9b (patch) | |
tree | 7df47b9dab0df1f0897ac90a96e8433363935017 /os-plugins/plugins/sysrqshutdown/files/shutdown | |
parent | Suse.pm: bugfix, forgot "," (diff) | |
download | core-5063f565d886884e84234e31c2290ecddd7b6f9b.tar.gz core-5063f565d886884e84234e31c2290ecddd7b6f9b.tar.xz core-5063f565d886884e84234e31c2290ecddd7b6f9b.zip |
created new plugin which bypasses original shutdown and uses SYSRQ keys instead.
only for '-r now' and '-h now', else original shutdown is used
Diffstat (limited to 'os-plugins/plugins/sysrqshutdown/files/shutdown')
-rw-r--r-- | os-plugins/plugins/sysrqshutdown/files/shutdown | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/os-plugins/plugins/sysrqshutdown/files/shutdown b/os-plugins/plugins/sysrqshutdown/files/shutdown new file mode 100644 index 00000000..7f4e9a1f --- /dev/null +++ b/os-plugins/plugins/sysrqshutdown/files/shutdown @@ -0,0 +1,54 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# Copyright (c) 2010 - RZ Uni FR +# Copyright (c) 2010 - 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/ +# ----------------------------------------------------------------------------- +# shutdown +# - Script for SYSRQ shutdown +################################################################################ + +. /etc/opt/openslx/openslx.conf + +################################################################################ +### Define default dirs / get configs +################################################################################ + +PLUGINCONFROOT=${OPENSLX_DEFAULT_CONFDIR}/plugins +PLUGINCONFVMGRID=${PLUGINCONFROOT}/sysrqshutdown +# include general configuration from vmgrid +if [ -f ${PLUGINCONFVMGRID}/sysrqshutdown.conf ]; then + . ${PLUGINCONFVMGRID}/sysrqshutdown.conf +else + sysrqshutdown_active=0 +fi + +if [ ${sysrqshutdown_active} -eq 1 ]; then + # check if reboot or halt + case "$@" in + '-r now') + for i in $(echo s u b); do + echo $i > /proc/sysrq-trigger & + done + exit 0 + ;; + '-h now') + for i in $(echo s u o); do + echo $i > /proc/sysrq-trigger & + done + exit 0 + ;; + esac +fi +# else use orig shutdown +shutdown.slxorig $@ + +exit 0 + |