summaryrefslogtreecommitdiff
path: root/scripts/ipmi.init.basic
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-06 18:04:32 +0200
committerJörg Frings-Fürst <debian@jff-webhosting.net>2014-07-06 18:04:32 +0200
commita7f89980e5b3f4b9a74c70dbc5ffe8aabd28be28 (patch)
tree41c4deec1fdfbafd7821b4ca7a9772ac0abd92f5 /scripts/ipmi.init.basic
Imported Upstream version 2.9.3upstream/2.9.3
Diffstat (limited to 'scripts/ipmi.init.basic')
-rwxr-xr-xscripts/ipmi.init.basic80
1 files changed, 80 insertions, 0 deletions
diff --git a/scripts/ipmi.init.basic b/scripts/ipmi.init.basic
new file mode 100755
index 0000000..f12c743
--- /dev/null
+++ b/scripts/ipmi.init.basic
@@ -0,0 +1,80 @@
+#!/bin/sh
+#
+# ipmi: OpenIPMI Driver init script (basic only)
+# Author: Andy Cress
+#
+# chkconfig: - 13 87
+# description: OpenIPMI Driver init script
+#
+# Use this if the Linux distro does not provide one.
+#Sample script to install it without chkconfig:
+#=====
+#ipmisvc=/etc/init.d/ipmi
+#cp -f ipmi.init.basic $ipmisvc
+#ln -s $ipmisvc /etc/rc0.d/K87ipmi
+#ln -s $ipmisvc /etc/rc1.d/K87ipmi
+#ln -s $ipmisvc /etc/rc6.d/K87ipmi
+#ln -s $ipmisvc /etc/rc2.d/S13ipmi
+#ln -s $ipmisvc /etc/rc3.d/S13ipmi
+#ln -s $ipmisvc /etc/rc4.d/S13ipmi
+#ln -s $ipmisvc /etc/rc5.d/S13ipmi
+#=====
+#
+rv=0
+
+start() {
+ lsmod |grep ipmi_dev >/dev/null
+ if [ $? -ne 0 ]; then
+ echo "Starting OpenIPMI driver ..."
+ # load the ipmi modules, if not already loaded or builtin
+ cat /proc/kallsyms |grep ipmi_init_msghandler >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ modprobe ipmi_msghandler
+ fi
+ cat /proc/kallsyms |grep init_ipmi_si >/dev/null 2>&1
+ if [ $? -ne 0 ]; then
+ modprobe ipmi_si
+ rv=$?
+ if [ $rv -ne 0 ]; then
+ modprobe ipmi_si_drv # try old module name
+ fi
+ fi
+ modprobe ipmi_devintf
+ modprobe ipmi_watchdog 2>/dev/null
+ fi
+
+ maj=$(cat /proc/devices | awk '/ipmidev/{print $1}')
+ if [ "x$maj" != "x" ]; then
+ test -e /dev/ipmi0 && rm -f /dev/ipmi0
+ /bin/mknod /dev/ipmi0 c $maj 0
+ fi
+}
+
+stop() {
+ lsmod |grep ipmi_msghandler >/dev/null
+ if [ $? -eq 0 ]; then
+ echo "Stopping OpenIPMI driver ..."
+ rmmod ipmi_poweroff 2>/dev/null
+ rmmod ipmi_watchdog 2>/dev/null
+ rmmod ipmi_devintf 2>/dev/null
+ rmmod ipmi_si
+ rv=$?
+ rmmod ipmi_msghandler
+ else
+ rv=2
+ fi
+}
+
+status() {
+ lsmod |grep ipmi
+ rv=$?
+}
+
+case "$1" in
+ start) start ;;
+ stop) stop ;;
+ status) status ;;
+ *) start ;;
+esac
+
+exit $rv