Bug 2412 - killproc() should return an error status if finds nothing to kill
: killproc() should return an error status if finds nothing to kill
Status: CLOSED FIXED
: Sisyphus
(All bugs in Sisyphus/initscripts)
: unstable
: all Linux
: P5 normal
Assigned To:
:
:
:
:
:
  Show dependency tree
 
Reported: 2003-03-23 21:17 by
Modified: 2003-08-25 15:18 (History)


Attachments


Note

You need to log in before you can comment on or make changes to this bug.


Description From 2003-03-23 21:17:22
(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 \"$base shutdown\"
+               RC=1
        fi
 
        # Remove pid file if any.

------- Comment #1 From 2003-03-24 00:12:06 -------
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 \"$base shutdown\"
+               if [ \"$notset\" = \"1\" ]; then
+                   failure \"$base shutdown\"
+               else
+                   failure \"$base $killlevel\"
+               fi
+               RC=1
        fi
 
        # Remove pid file if any.
------- Comment #2 From 2003-03-24 00:12:06 -------
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 \"$base shutdown\"
+               if [ \"$notset\" = \"1\" ]; then
+                   failure \"$base shutdown\"
+               else
+                   failure \"$base $killlevel\"
+               fi
+               RC=1
        fi
 
        # Remove pid file if any.
------- Comment #3 From 2003-04-20 00:04:11 -------
Thanks, fixed in 5.49-ipl54mdk
------- Comment #4 From 2003-04-20 00:04:11 -------
Thanks, fixed in 5.49-ipl54mdk