Bug 2412

Summary: killproc() should return an error status if finds nothing to kill
Product: Sisyphus Reporter: imz <vanyaz>
Component: initscriptsAssignee: Dmitry V. Levin <ldv>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5    
Version: unstable   
Hardware: all   
OS: Linux   

Description imz 2003-03-23 21:17:22 MSK
(imho.)

In  /etc/init.d/functions, killproc() displays a failure when no matching processes are found, but the returned error code is 0 in this case. This makes further diagnostic more difficult.

---
# service bind stop
Shutting down named:                                                                                                                                                     [  OK  ]
# service bind reload; echo $?
                                                                                                                                                                         [FAILED]0

After the suggested patch:

# service bind reload; echo $?
                                                                                                                                                                         [FAILED]1

---
This is a possible patch:

--- /etc/init.d/functions.orig  2003-03-23 01:51:54 +0300
+++ /etc/init.d/functions       2003-03-23 21:11:56 +0300
@@ -239,6 +239,7 @@
                fi
        else
                failure \&quot;$base shutdown\&quot;
+               RC=1
        fi
 
        # Remove pid file if any.

Comment 1 imz 2003-03-24 00:12:06 MSK
Addition: message refined (not to log a reload failure as a shutdown failure):

--- /etc/init.d/functions.orig  2003-03-23 01:51:54 +0300
+++ /etc/init.d/functions       2003-03-24 00:06:37 +0300
@@ -238,7 +238,12 @@
                        fi
                fi
        else
-               failure \&quot;$base shutdown\&quot;
+               if [ \&quot;$notset\&quot; = \&quot;1\&quot; ]; then
+                   failure \&quot;$base shutdown\&quot;
+               else
+                   failure \&quot;$base $killlevel\&quot;
+               fi
+               RC=1
        fi
 
        # Remove pid file if any.
Comment 2 imz 2003-03-24 00:12:06 MSK
Addition: message refined (not to log a reload failure as a shutdown failure):

--- /etc/init.d/functions.orig  2003-03-23 01:51:54 +0300
+++ /etc/init.d/functions       2003-03-24 00:06:37 +0300
@@ -238,7 +238,12 @@
                        fi
                fi
        else
-               failure \&quot;$base shutdown\&quot;
+               if [ \&quot;$notset\&quot; = \&quot;1\&quot; ]; then
+                   failure \&quot;$base shutdown\&quot;
+               else
+                   failure \&quot;$base $killlevel\&quot;
+               fi
+               RC=1
        fi
 
        # Remove pid file if any.
Comment 3 Dmitry V. Levin 2003-04-20 00:04:11 MSD
Thanks, fixed in 5.49-ipl54mdk
Comment 4 Dmitry V. Levin 2003-04-20 00:04:11 MSD
Thanks, fixed in 5.49-ipl54mdk