From ceed481524fe7e273727b2b37ba54132936087e6 Mon Sep 17 00:00:00 2001 From: DJ Lucas Date: Sun, 26 Oct 2008 06:58:59 +0000 Subject: Added Dan Nicholson's patch for #2160, and cleaned up tab/spacing in changelog. git-svn-id: http://svn.linuxfromscratch.org/LFS/trunk/BOOK@8701 4aa44e1e-78dd-0310-a6d2-fbcd4c07a689 --- bootscripts/ChangeLog | 52 +++++++++++++++++++++++----------------- bootscripts/lfs/init.d/functions | 20 ++++++++++++---- 2 files changed, 46 insertions(+), 26 deletions(-) diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog index 4ec455366..eec6d5042 100644 --- a/bootscripts/ChangeLog +++ b/bootscripts/ChangeLog @@ -1,7 +1,14 @@ +2008-10-26 Dan Nicholson + * lfs/init.d/functions: Remove stale pid files when encountered + in loadproc/killproc/reloadproc. When the bootscript specifies + a pid file to use with the "-p pidfile" argument, *proc + functions previously bailed out when the referenced file + contains an invalid pid. + 2008-10-23 DJ Lucas * lfs/init.d/console: Removed BROKEN_COMPOSE as kernel patch has been accepted upstream. - + 2008-05-21 Bryan Kadzban * lfs/init.d/udev: lfs/init.d/udev_retry: Use new udevadm program. @@ -100,7 +107,7 @@ n/a - June 2, 2006 * Removed console config file and makefile targets. * Removed references to /dev/bug and bugreport in udevand - udev_retry bootscripts. (DJ Lucas) + udev_retry bootscripts. (DJ Lucas) n/a - April 17, 2006 * Updated udev script to use the new udevsettle program. * Added udev_retry script for systems that have /usr on a different @@ -108,26 +115,26 @@ n/a - April 17, 2006 n/a - April 15, 2006 * Cleaned up contrib directory. Removed: contrib/init.d, - contrib/enhanced, contrib/livecd, contrib/hotplug, and raq2 + contrib/enhanced, contrib/livecd, contrib/hotplug, and raq2 patch. (DJ Lucas) n/a - April 14, 2006 - * Merged changes from udev_update branch (DJ Lucas) + * Merged changes from udev_update branch (DJ Lucas) * Replaced a return with an exit and reversed comment changes in - udev bootscript. (Dan Nicholson) + udev bootscript. (Dan Nicholson) * Replaced walk_sysfs function in udev bootscript with new udevtrigger - program and move wait_for_uevents function inline. (DJ Lucas) + program and move wait_for_uevents function inline. (DJ Lucas) * Removed extra evaluate_retval in udev bootscript. (Ken Moffat) - * Wait for uevents to be processed in the udev script. See ticket #1720 - for details. (Matthew Burgess) + * Wait for uevents to be processed in the udev script. See ticket + #1720 for details. (Matthew Burgess) n/a - March 21, 2006 - * Removed old references to boot_log function and arguments passed - to boot_mesg_flush in echo_* functions. (DJ Lucas) + * Removed old references to boot_log function and arguments passed + to boot_mesg_flush in echo_* functions. (DJ Lucas) n/a - March 10, 2006 * Moved src argument to ipv4-static-route service script and - removed from ipv4-static service script. (DJ Lucas) + removed from ipv4-static service script. (DJ Lucas) n/a - March 8. 2006 * Correct sourced path in checkfs script. (Matthew Burgess) @@ -287,7 +294,8 @@ n/a - November 25, 2004 related to boot_mesg changes (DJ Lucas, Alexander Patrakov) * syslog-ng is now installed by default (Jeremy Utley) * hotplug is now installed by default (Jeremy Utley) - * udev now uses /sbin/hotplug as the default hotplug handler (Nathan Coulson) + * udev now uses /sbin/hotplug as the default hotplug handler + (Nathan Coulson) * udev now mounts a tmpfs instead of a ramfs onto /dev, as suggested by Greg K-H (Nathan Coulson) * Created contrib/lsb, and added a LSB compliant functions file @@ -354,8 +362,8 @@ n/a - September 22, 2004 * All scriptes have been converted to use boot_mesg n/a - September 21, 2004 - * boot_mesg has been enhanced. Subsequent calls will overwrite previous - text, and it will wrap text basedupon the variable ${WCOL}. + * boot_mesg has been enhanced. Subsequent calls will overwrite + previous text, and it will wrap text basedupon the variable ${WCOL}. (James Robertson) * Fixed mtu optional service typo (Kevin P Fleming) * Added SOURCE variable to ipv4-static-route (Kevin P Fleming) @@ -806,7 +814,7 @@ n/a - February 2, 2004: * Fixed network shutdown script * Fixed Makefile rc.6 to reboot * Added -s flag to grep command in rc.d/init.d/network - - suppresses an error if no ifconfig.* files exist + suppresses an error if no ifconfig.* files exist n/a - January 30, 2004: @@ -827,8 +835,8 @@ n/a - January 30, 2004: n/a - January 30, 2004: * New maintainers for the lfs-bootscripts package are: - Jeremy Utley (jeremy@linuxfromscratch.org) - Nathan Coulson (nathan@linuxfromscratch.org) + Jeremy Utley (jeremy@linuxfromscratch.org) + Nathan Coulson (nathan@linuxfromscratch.org) 1.11 - February 3rd, 2003: @@ -838,7 +846,7 @@ n/a - January 30, 2004: 1.10 - September 12th, 2002: * Fixed up checkfs to work with non-ext2 filesystems too (such as - minix). + minix). 1.9 - April 5th, 2002: @@ -884,9 +892,9 @@ n/a - January 30, 2004: 1.6 - February 26th, 2002: * replaced -o %PPID with -o $PPID throughout the functions script. This - construct does what it's supposed to do (don't take PPID into account - because this would fail if a running daemon and the bootscript have - the same name). + construct does what it's supposed to do (don't take PPID into account + because this would fail if a running daemon and the bootscript have + the same name). * added 'restart' to the swap script @@ -914,7 +922,7 @@ n/a - January 30, 2004: variable is set * removed the emptying of /etc/mtab since it's a symlink to - /proc/mounts now + /proc/mounts now * added the mountproc script which mounts the proc system. This is done because we need proc mounted even before the mountfs script is ran diff --git a/bootscripts/lfs/init.d/functions b/bootscripts/lfs/init.d/functions index a9e13fd27..7a0b584c0 100644 --- a/bootscripts/lfs/init.d/functions +++ b/bootscripts/lfs/init.d/functions @@ -291,6 +291,12 @@ reloadproc() pidofproc -s -p "${pidfile}" "${1}" fi + # Warn about stale pid file + if [ "$?" = 1 ]; then + boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING} + rm -f "${pidfile}" + fi + if [ -n "${pidlist}" ]; then for pid in ${pidlist} do @@ -504,7 +510,7 @@ getpids() # warning in stdout # return 4 - Program or service status is unknown # -# Dependencies: nice +# Dependencies: nice, rm # # Todo: LSB says this should be called start_daemon # LSB does not say that it should call evaluate_retval @@ -567,8 +573,8 @@ loadproc() return 0 # 4 ;; 1) - log_warning_msg "Unable to continue: ${pidfile} exists" - return 0 # 4 + boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING} + rm -f "${pidfile}" ;; 3) ;; @@ -598,7 +604,7 @@ loadproc() # warning in stdout # return 4 - Unknown Status # -# Dependencies: kill +# Dependencies: kill, rm # # Todo: LSB does not say that it should call evaluate_retval # It checks for PIDFILE, which is deprecated. @@ -648,6 +654,12 @@ killproc() pidofproc -s -p "${pidfile}" "${1}" fi + # Remove stale pidfile + if [ "$?" = 1 ]; then + boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING} + rm -f "${pidfile}" + fi + # If running, send the signal if [ -n "${pidlist}" ]; then for pid in ${pidlist} -- cgit v1.2.3-54-g00ecf