freeipmi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Freeipmi-devel] fix for bmc-watchdog init script on SuSE


From: Dave Love
Subject: [Freeipmi-devel] fix for bmc-watchdog init script on SuSE
Date: Wed, 14 Jan 2009 15:33:27 +0000
User-agent: Gnus/5.110011 (No Gnus v0.11)

The bmc-watchdog init script currently has only RedHat conventions.
This patch against the 0.7.4 version makes it consistent with the
ipmidetectd, to work on SuSE.

[Please copy any replies to me, as I'm not on the list.]

2009-01-14  Dave Love  <address@hidden>

        * bmc-watchdog/freeipmi-bmc-watchdog.init: Make SuSE-compatible,
        like the other init scripts.

--- freeipmi-bmc-watchdog.init  2009/01/14 15:13:28     1.1
+++ freeipmi-bmc-watchdog.init  2009/01/14 15:15:09
@@ -3,46 +3,109 @@
 # chkconfig: - 99 01
 # description: bmc-watchdog startup script
 #
+### BEGIN INIT INFO
+# Provides: bmc-watchdog
+# Required-Start: $network $remote_fs $syslog
+# Required-Stop:  $network $remote_fs $syslog
+# Default-Stop:   0 1 2 6
+# Short-Description: Start and stop bmc-watchdog
+# Description: BMC watchdog timer daemon
+### END INIT INFO
+
 DAEMON=/usr/sbin/bmc-watchdog
 PIDFILE=/var/run/freeipmi-bmc-watchdog.pid
 LOCKFILE=/var/lock/subsys/freeipmi-bmc-watchdog
 CONFFILE=/etc/sysconfig/freeipmi-bmc-watchdog
 
-. /etc/rc.d/init.d/functions
-
-RETVAL=0
+[ -f $DAEMON ] || exit 1
 
 if [ -r $CONFFILE ]; then
         . $CONFFILE
 fi
 
+# Load Redhat or Suse appropriate libs
+if [ -f /etc/rc.d/init.d/functions ] ; then
+    . /etc/rc.d/init.d/functions
+    Xstart() {
+
+        # Default deamon mode
+        #
+        # timer use = SMS/OS
+        # pre-timeout interrupt = none
+        # action = reset
+        # -F, -P, -L, -S, -O - clear flags
+        # initial-countdown = 900 seconds (15 mins)
+        # reset-period = 60 seconds
+
+        daemon -20 $DAEMON $OPTIONS
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && touch $LOCKFILE
+    }
+    Xstop() {
+        killproc bmc-watchdog
+        RETVAL=$?
+        echo
+        [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
+    }
+    Xstatus() {
+        status bmc-watchdog
+       RETVAL=$?
+    }
+    Xcondrestart() {
+        if test -e $LOCKFILE; then
+           $0 stop
+           $0 start
+           RETVAL=$?
+        fi
+    }
+    Xexit() {
+       exit $RETVAL
+    }
+elif [ -f /etc/rc.status ] ; then
+    . /etc/rc.status
+    Xstart() {
+        startproc -20 $DAEMON $OPTIONS
+        rc_status -v
+    }
+    Xstop() {
+        killproc -TERM $DAEMON
+        rc_status -v
+    }
+    Xstatus() {
+        echo -n "Checking for bmc-watchdog: "
+        checkproc $DAEMON
+        rc_status -v
+    }
+    Xcondrestart() {
+        $0 status
+        if test $? = 0; then
+            $0 restart
+        else
+            rc_reset
+        fi
+        rc_status
+    }
+    Xexit() {
+       rc_exit
+    }
+else
+    echo "Unknown distribution type"
+    exit 1
+fi
+
+RETVAL=0
+
 case "$1" in
    start)
       echo -n "Starting bmc-watchdog: "
-      [ -f $DAEMON ] || exit 1
-
-      # Default deamon mode
-      #
-      # timer use = SMS/OS
-      # pre-timeout interrupt = none
-      # action = reset
-      # -F, -P, -L, -S, -O - clear flags
-      # initial-countdown = 900 seconds (15 mins)
-      # reset-period = 60 seconds
-
-      daemon -20 $DAEMON $OPTIONS
-      RETVAL=$?
-      echo
-      [ $RETVAL -eq 0 ] && touch $LOCKFILE
-       ;;
+      Xstart
+      ;;
 
   stop)
       echo -n "Shutting down bmc-watchdog: "
-      killproc bmc-watchdog
-      RETVAL=$?
-      echo
-      [ $RETVAL -eq 0 ] && rm -f $LOCKFILE
-       ;;
+      Xstop
+      ;;
 
   restart|reload)
        $0 stop
@@ -50,15 +113,10 @@
        RETVAL=$?
        ;;
   status)
-       status bmc-watchdog
-       RETVAL=$?
+       Xstatus
        ;;
   condrestart)
-        if test -e $LOCKFILE; then \
-            $0 stop; \
-            $0 start; \
-            RETVAL=$?; \
-        fi
+        Xcondrestart
         ;;
   *)
        echo "Usage: $0 {start|stop|restart|status|condrestart}"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]