blob: 7e575ed3472b9cce08d2a53da5a5ff8d9c8c32fa (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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
|