]> git.sven.stormbind.net Git - sven/mpt-status.git/blobdiff - mpt-status.init
changelog spacing fix
[sven/mpt-status.git] / mpt-status.init
index c6d9f4844d3e2f4fa93a814b91d8b6aee420c525..6599f3c52096bdc1c1c2c41b3605dad3dc27a72e 100644 (file)
@@ -6,16 +6,15 @@
 
 # mpt-statusd - Check mpt-status values in the background.
 #
 
 # mpt-statusd - Check mpt-status values in the background.
 #
-# chkconfig:   345 60 50
+# chkconfig: - 60 50
 # description: Check mpt-status values in the background \
 # using daemonize and the mpt-status utility.
 
 ### BEGIN INIT INFO
 # description: Check mpt-status values in the background \
 # using daemonize and the mpt-status utility.
 
 ### BEGIN INIT INFO
-# Provides:          mpt-statusd
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
+# Provides: mpt-statusd
+# Required-Start: $remote_fs $syslog
+# Required-Stop: $remote_fs $syslog
+# Default-Stop: 0 1 6
 # Short-Description: Check mpt-status values in the background.
 ### END INIT INFO
 
 # Short-Description: Check mpt-status values in the background.
 ### END INIT INFO
 
@@ -25,7 +24,7 @@ NAME=mpt-statusd
 PIDFILE=/var/run/$NAME.pid
 STATUSFILE=/var/run/$NAME.status
 SCRIPTNAME=/etc/init.d/$NAME
 PIDFILE=/var/run/$NAME.pid
 STATUSFILE=/var/run/$NAME.status
 SCRIPTNAME=/etc/init.d/$NAME
-
+LOCKFILE=/var/lock/subsys/$NAME
 
 # Do not touch you can configure this in /etc/default/mpt-statusd
 MAILTO=root   # Where to report problems
 
 # Do not touch you can configure this in /etc/default/mpt-statusd
 MAILTO=root   # Where to report problems
@@ -41,10 +40,9 @@ test -x /usr/sbin/mpt-status || exit 0
 
 # Source function library.
 . /etc/rc.d/init.d/functions
 
 # Source function library.
 . /etc/rc.d/init.d/functions
-. /lib/lsb/init-functions
 
 if [ $RUN_DAEMON = "no" ] ; then
 
 if [ $RUN_DAEMON = "no" ] ; then
-       log_failure_msg $"mpt-statusd is disabled in /etc/default/mpt-statusd, not starting."
+        echo "mpt-statusd is disabled in /etc/default/mpt-statusd, not starting." && failure
        exit 0
 fi
 
        exit 0
 fi
 
@@ -53,7 +51,7 @@ fi
 modprobe mptctl || true
 
 if ! [ -e "/proc/mpt/version" ] ; then
 modprobe mptctl || true
 
 if ! [ -e "/proc/mpt/version" ] ; then
-       log_failure_msg "The mptctl module is missing."
+       echo "The mptctl module is missing." && failure
        exit 0
 fi
 
        exit 0
 fi
 
@@ -137,16 +135,16 @@ check_daemon() {
 d_start() {
     [ -f $PIDFILE ] && PID="`cat $PIDFILE`"
     if [ "$PID" ] ; then
 d_start() {
     [ -f $PIDFILE ] && PID="`cat $PIDFILE`"
     if [ "$PID" ] ; then
-        log_warning_msg "Daemon already running. Refusing to start another"
+        echo "Daemon already running. Refusing to start another" && warning
         return 0
     elif check_daemon ; then
        # Use daemonize to turn it into a daemon and start it with daemon().
         daemon --pidfile $PIDFILE /usr/sbin/daemonize $SCRIPTNAME check_mpt
        RETVAL=$?
         return 0
     elif check_daemon ; then
        # Use daemonize to turn it into a daemon and start it with daemon().
         daemon --pidfile $PIDFILE /usr/sbin/daemonize $SCRIPTNAME check_mpt
        RETVAL=$?
-       [ $RETVAL -eq 0 ] && rm -f $PIDFILE
+       [ $RETVAL -eq 0 ] && touch $LOCKFILE
        return $RETVAL
     else
        return $RETVAL
     else
-        log_warning_msg "Daemon is already running. Refusing to start another"
+        echo "Daemon is already running. Refusing to start another" && warning
         return 0
     fi
 }
         return 0
     fi
 }
@@ -160,14 +158,14 @@ d_stop() {
                RETVAL=$?
                if [ $RETVAL -eq 0 ] ; then
                    success "$NAME stopped"
                RETVAL=$?
                if [ $RETVAL -eq 0 ] ; then
                    success "$NAME stopped"
-                   rm -f $PIDFILE
+                   rm -f $PIDFILE $LOCKFILE
                    return 0
                else
                    return 0
                else
-                   log_failure_msg "$NAME failed to stop"
+                   echo "$NAME failed to stop" && failure
                    return 1
                fi
         else
                    return 1
                fi
         else
-                log_warning_msg "$NAME is already stopped."
+                echo "$NAME is already stopped." && warning
                 return 0
         fi
 }
                 return 0
         fi
 }
@@ -177,9 +175,9 @@ d_stop() {
 d_stop_by_restart() {
         if [ -f $PIDFILE ] ; then
                 killproc -p $PIDFILE $SCRIPTNAME > /dev/null 2>&1
 d_stop_by_restart() {
         if [ -f $PIDFILE ] ; then
                 killproc -p $PIDFILE $SCRIPTNAME > /dev/null 2>&1
-                rm -f $PIDFILE
+                rm -f $PIDFILE $LOCKFILE
         else
         else
-                log_warning_msg "Daemon is already stopped."
+                echo "Daemon is already stopped." && warning
         fi
 }
 
         fi
 }