summaryrefslogtreecommitdiff
path: root/scripts/ipmi.init.basic
diff options
context:
space:
mode:
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