From e66413628d95f8c9d91a2080768501946c0d5514 Mon Sep 17 00:00:00 2001 From: Michael Janczyk Date: Tue, 11 Dec 2012 17:20:53 +0100 Subject: 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 --- .../plugins/sysrqshutdown/files/sysrqshutdown.sh | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh (limited to 'src/os-plugins/plugins/sysrqshutdown/files/sysrqshutdown.sh') 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 + -- cgit v1.2.3-55-g7522