r8496 - in trunk/bootscripts/contrib/lsb-v3: . lsb

dj at linuxfromscratch.org dj at linuxfromscratch.org
Fri Mar 14 23:47:29 PDT 2008


Author: dj
Date: 2008-03-15 00:47:29 -0600 (Sat, 15 Mar 2008)
New Revision: 8496

Modified:
   trunk/bootscripts/contrib/lsb-v3/Changelog
   trunk/bootscripts/contrib/lsb-v3/lsb/init-functions
Log:
contrib/lsb-v3 - added missing stale pid file checking for pidofproc

Modified: trunk/bootscripts/contrib/lsb-v3/Changelog
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/Changelog	2008-03-12 23:37:10 UTC (rev 8495)
+++ trunk/bootscripts/contrib/lsb-v3/Changelog	2008-03-15 06:47:29 UTC (rev 8496)
@@ -1,5 +1,11 @@
+Change Log
+
+20080315 - [dj] * Added missing 'stale pid file' checking for pidofproc()
+
 20080210 - [dj] * Updated documentation
+
 20070820 - [dj] * Synced with LFS-bootscripts
+
 20070705 - [dj] * Synced with LFS-bootscripts
                 * Removed 'stty' from the environment setup as it breaks 
                   custom key configs when run from the CLI.

Modified: trunk/bootscripts/contrib/lsb-v3/lsb/init-functions
===================================================================
--- trunk/bootscripts/contrib/lsb-v3/lsb/init-functions	2008-03-12 23:37:10 UTC (rev 8495)
+++ trunk/bootscripts/contrib/lsb-v3/lsb/init-functions	2008-03-15 06:47:29 UTC (rev 8496)
@@ -83,15 +83,15 @@
         then
             # determine the pid by discovery
             pidlist=`pidofproc "${1}"`
+            retval="${?}"
         else
             # The PID file contains the needed PIDs
             # Note that by LSB requirement, the path must be given to pidofproc,
             # however, it is not used by the current implementation or standard.
             pidlist=`pidofproc -p "${pidfile}" "${1}"`
+            retval="${?}"
         fi
 
-        retval="${?}"
-
         # return a value ONLY 
         # It is the init script's (or distribution's functions) responsibilty
         # to log messages!
@@ -103,6 +103,12 @@
                 return 0
                 ;;
 
+            1)
+                # program is not running, but an invalid pid file exists
+                # remove the pid file and continue
+                rm -f "${pidfile}"
+                ;;
+
             3)
                 # program is not running and no pidfile exists
                 # do nothing here, let start_deamon continue.
@@ -205,15 +211,15 @@
     then
         # determine the pid by discovery
         pidlist=`pidofproc "${1}"`
+        retval="${?}"
     else
         # The PID file contains the needed PIDs
         # Note that by LSB requirement, the path must be given to pidofproc,
         # however, it is not used by the current implementation or standard.
         pidlist=`pidofproc -p "${pidfile}" "${1}"`
+        retval="${?}"
     fi
 
-    retval="${?}"
-
     # return a value ONLY
     # It is the init script's (or distribution's functions) responsibilty
     # to log messages!
@@ -224,6 +230,19 @@
             # do nothing here, let killproc continue.
             ;;
 
+        1)
+            # program is not running, but an invalid pid file exists
+            # remove the pid file.
+            rm -f "${pidfile}"
+            # this is only a success if no signal was passed.
+            if [ -n "${nosig}" ]
+            then
+                return 0
+            else
+                return 7
+            fi
+            ;;
+
         3)
             # program is not running and no pidfile exists
             # this is only a success if no signal was passed.
@@ -339,6 +358,7 @@
 local progname
 local pidlist
 local lpids
+local exitstatus="0"
 
     # Process arguments
     while true
@@ -395,6 +415,8 @@
         kill -0 ${pid} 2> /dev/null
         if [ "${?}" = "0" ]; then
             lpids="${pids}${pid} "
+        else
+            exitstatus="1"
         fi
     done
 
@@ -402,6 +424,7 @@
         return 3
     else
         echo "${lpids}"
+        return "${exitstatus}"
     fi
 }
 ################################################################################




More information about the lfs-book mailing list