Bug 2412 - killproc() should return an error status if finds nothing to kill
Summary: killproc() should return an error status if finds nothing to kill
Status: CLOSED FIXED
Alias: None
Product: Sisyphus
Classification: Development
Component: initscripts (show other bugs)
Version: unstable
Hardware: all Linux
: P5 normal
Assignee: Dmitry V. Levin
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-23 21:17 MSK by imz
Modified: 2003-08-25 15:18 MSD (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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 \"$base shutdown\"
+               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 \"$base shutdown\"
+               if [ \"$notset\" = \"1\" ]; then
+                   failure \"$base shutdown\"
+               else
+                   failure \"$base $killlevel\"
+               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 \"$base shutdown\"
+               if [ \"$notset\" = \"1\" ]; then
+                   failure \"$base shutdown\"
+               else
+                   failure \"$base $killlevel\"
+               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