Public bug reported:

Binary package hint: irqbalance

the current script fails to create the /var/run/irqbalance.pid file and 
executing /etc/init.d/irqbalance stop always returns:
"Stopping SMP IRQ Balancer: No irqbalance found running; none killed."
even when irqbalance is indeed running.

This patch strengthens the logic and adds the status option, apply
against /etc/init.d/irqbalance.

--- /home/dev-home/irqbalance-old        2007-07-14 01:01:41.000000000 -0400
+++ /home/dev-home/irqbalance    2007-07-14 01:01:27.000000000 -0400
@@ -33,10 +33,19 @@
 case "$1" in
   start)
         echo -n "Starting $DESC: "
+
+        if pidof $PNAME >/dev/null
+        then 
+               echo "Already running."
+                exit 0
+        fi
+
         start-stop-daemon --start --pidfile $PIDFILE \
-               --name $PNAME --oknodo --startas $DAEMON \
+               --name $PNAME --oknodo --startas $DAEMON \
             -- $OPTIONS $DOPTIONS
-        
+
+       pidof $PNAME > $PIDFILE        
+
         echo "$NAME."
         ;;
   stop)
@@ -44,7 +53,12 @@
         
         start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME --oknodo
         
-        echo "$NAME."
+       if [ -e "$PIDFILE" ]
+       then
+               rm $PIDFILE
+               echo "$NAME."
+       fi
+
         ;;
   restart|force-reload)
         echo -n "Restarting $DESC: "
@@ -56,11 +70,22 @@
         
         echo "$NAME."
         ;;
+  status)
+        if pidof $PNAME >/dev/null
+        then
+            echo "$DESC running."
+            exit 0
+        else
+            echo "$DESC not running."
+            exit 3
+        fi
+        ;;
   *)
         N=/etc/init.d/$SNAME
-        echo "Usage: $N {start|stop|restart|force-reload}" >&2
+        echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
         exit 1
         ;;
+
 esac
 
 exit 0

** Affects: irqbalance (Ubuntu)
     Importance: Undecided
         Status: New

-- 
current irqblance init.d script doesn't stop daemon
https://bugs.launchpad.net/bugs/125926
You received this bug notification because you are a member of Ubuntu
Bugs, which is the bug contact for Ubuntu.

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to