summaryrefslogtreecommitdiff
path: root/debian/ipmitool.ipmievd.init
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-07-28 18:16:44 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-07-28 18:16:44 +0200
commit908c4346d9f66b96d12767bfe9e53d45fb24a6f6 (patch)
treed3ecc1aee9042a99e98b7252e681a79da5b90b08 /debian/ipmitool.ipmievd.init
parentc41d9476dcfce18a0105f96e9b63272e63f15051 (diff)
Add System V init scripts again
Diffstat (limited to 'debian/ipmitool.ipmievd.init')
-rw-r--r--debian/ipmitool.ipmievd.init126
1 files changed, 126 insertions, 0 deletions
diff --git a/debian/ipmitool.ipmievd.init b/debian/ipmitool.ipmievd.init
new file mode 100644
index 0000000..dcd0c28
--- /dev/null
+++ b/debian/ipmitool.ipmievd.init
@@ -0,0 +1,126 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides: ipmievd
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Start: 2 3 4 5
+# Default-Stop: 0 1 6
+# Short-Description: IPMI event daemon
+# Description: ipmievd is a daemon which will listen for events
+# from the BMC that are being sent to the SEL and
+# also log those messages to syslog.
+### END INIT INFO
+#
+# Author: Elmar Hoffmann <elho@elho.net>
+# Licence: This script is public domain using the same
+# licence as ipmitool itself.
+# Modified by: Petter Reinholdtsen
+# Jörg Frings-Fürst 2014-06-01
+
+set -e
+
+PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
+DESC="IPMI event daemon"
+NAME=ipmievd
+DAEMON=/usr/sbin/$NAME
+PIDFILE=/var/run/$NAME.pid0
+SCRIPTNAME=/etc/init.d/$NAME
+ENABLED=true
+
+# Gracefully exit if the package has been removed.
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+test -r /etc/default/rcS && . /etc/default/rcS
+
+# Options used by ipmievd.
+#
+# "open" uses the asynchronous event notification from the OpenIPMI
+# kernel driver, "sel" uses active polling of the contents of the SEL
+# for new events.
+#
+# Need to force 'daemon' mode, to make sure messages are sent to
+# syslog and the program forks into the background.
+#
+# Se ipmievd(8) for more info.
+IPMIEVD_OPTIONS="open daemon"
+
+#
+# requested kernelmodules
+#
+#REQMODULES="ipmi_devintf ipmi_msghandler ipmi_poweroff ipmi_si ipmi_watchdog"
+REQMODULES=""
+
+# Read config file if it is present.
+[ -f /etc/default/$NAME ] && . /etc/default/$NAME
+
+test "$ENABLED" != "false" || exit 0
+
+# Backwards compatibility with version 1.8.6-2 and 1.8.6-1. The
+# variable was renamed to be compatible with upstream, SuSe and RedHat.
+if [ -n "$IPMIEVD_OPTS" ]; then
+ echo "warning: /etc/default/$NAME variable IPMIEVD_OPTS should be renamed to IPMIEVD_OPTIONS"
+ IPMIEVD_OPTIONS="$IPMIEVD_OPTS"
+fi
+
+#
+# function to load requested kernelmodules
+do_modprobe() {
+ if [ -x /sbin/modprobe -a -f /proc/modules ]
+ then
+ modprobe -q "$1" || true
+ fi
+}
+
+#
+# Function that starts the daemon/service.
+#
+d_start() {
+ start-stop-daemon --start --quiet --exec $DAEMON --pidfile $PIDFILE -- $IPMIEVD_OPTIONS
+}
+
+#
+# Function that stops the daemon/service.
+#
+d_stop() {
+ start-stop-daemon --stop --oknodo --quiet --name $NAME --exec $DAEMON --pidfile $PIDFILE
+}
+
+CODE=0
+
+case "$1" in
+ start)
+ # load kernelmodules
+ for rmod in ${REQMODULES}
+ do
+ do_modprobe ${rmod}
+ done
+ [ "$VERBOSE" != no ] && log_begin_msg "Starting $DESC" "$NAME"
+ d_start || CODE=$?
+ [ "$VERBOSE" != no ] && log_end_msg $CODE
+ exit $CODE
+ ;;
+ stop)
+ log_begin_msg "Stopping $DESC" "$NAME"
+ d_stop || CODE=$?
+ log_end_msg $CODE
+ exit $CODE
+ ;;
+ restart|force-reload)
+ log_begin_msg "Restarting $DESC" "$NAME"
+ d_stop || true
+ sleep 1
+ d_start || CODE=$?
+ log_end_msg $CODE
+ exit $CODE
+ ;;
+ status)
+ status_of_proc $DAEMON $NAME
+ ;;
+ *)
+ echo "Usage: $SCRIPTNAME {start|stop|restart|force-reload|status}" >&2
+ exit 1
+ ;;
+esac
+
+exit 0