summaryrefslogblamecommitdiffstats
path: root/os-plugins/plugins/sysrqshutdown/files/shutdown
blob: 7f4e9a1f913e17c49f4538dd62db07e08019e907 (plain) (tree)





















































                                                                                
#!/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