pidof is a very fragile way of doing things, and will catch stuff like
    ln -s /bin/sleep ~/irqbalance; ~/irqbalance 9999
irqbalance also will not delete its own pidfile when killed.

Using --exec and --user will tend to do the right thing, with some 
(dis)advantages:
- Doesn't start a new instance when one is started manually
- Stops any instances started manually
- Doesn't match processes which aren't started by non-root (even if they happen 
to have the pid in the pidfile)
- Doesn't catch processes if the executable is overwritten (not a problem, 
since an upgrade should stop the daemon before files are touched)

I would attach a patch, but I'm not sure how to get sendmail to do that (and I 
don't feel like MIME)

--- irqbalance.orig     2009-01-26 17:19:20.000000000 +0000
+++ irqbalance  2009-01-26 17:25:12.000000000 +0000
@@ -41,6 +41,6 @@
   start)
         echo -n "Starting $DESC: "
-        start-stop-daemon --start --pidfile $PIDFILE \
-               --name $PNAME --oknodo --startas $DAEMON \
+        start-stop-daemon --start --exec $DAEMON \
+               --user root --oknodo --startas $DAEMON \
             -- $OPTIONS $DOPTIONS
         
@@ -50,5 +50,5 @@
         echo -n "Stopping $DESC: "
         
-        start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME --oknodo
+        start-stop-daemon --stop --exec $DAEMON --user root --oknodo
         
         echo "$NAME."
@@ -56,8 +56,8 @@
   restart|force-reload)
         echo -n "Restarting $DESC: "
-        start-stop-daemon --stop --pidfile $PIDFILE --name $PNAME \
+        start-stop-daemon --stop --user root --exec $DAEMON \
             --retry 5 --oknodo
-        start-stop-daemon --start --pidfile $PIDFILE \
-            --name $PNAME --oknodo --startas $DAEMON \
+        start-stop-daemon --start --user root \
+            --exec $DAEMON --oknodo --startas $DAEMON \
             -- $OPTIONS $DOPTIONS



-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to