commit 77f8dc9597436905f3a59ca942c6ee32c2e05e5f
Author: Dan Nicholson <dbn.lists@gmail.com>
Date: Wed Mar 12 14:04:53 2008 -0700
Remove stale pid files when encountered in loadproc/killproc/reloadproc
diff --git a/bootscripts/ChangeLog b/bootscripts/ChangeLog
index 2c7273b..f982866 100644
|
a
|
b
|
|
| | 1 | 2008-03-12 Dan Nicholson <dnicholson@linuxfromscratch.org> |
| | 2 | * lfs/init.d/functions: Remove stale pid files when encountered |
| | 3 | in loadproc/killproc/reloadproc. When the bootscript specifies |
| | 4 | a pid file to use with the "-p pidfile" argument, *proc |
| | 5 | functions previously bailed out when the referenced file |
| | 6 | contains an invalid pid. |
| | 7 | |
| 1 | 8 | 2007-08-20 DJ Lucas <dj@linuxfromscratch.org> |
| 2 | 9 | * lfs/init.d/setclock: Added missing 'stop' argument to usage text |
| 3 | 10 | |
diff --git a/bootscripts/lfs/init.d/functions b/bootscripts/lfs/init.d/functions
index a9e13fd..7a0b584 100644
|
a
|
b
|
reloadproc()
|
| 291 | 291 | pidofproc -s -p "${pidfile}" "${1}" |
| 292 | 292 | fi |
| 293 | 293 | |
| | 294 | # Warn about stale pid file |
| | 295 | if [ "$?" = 1 ]; then |
| | 296 | boot_mesg -n "Removing stale pid file: ${pidfile}. " ${WARNING} |
| | 297 | rm -f "${pidfile}" |
| | 298 | fi |
| | 299 | |
| 294 | 300 | if [ -n "${pidlist}" ]; then |
| 295 | 301 | for pid in ${pidlist} |
| 296 | 302 | do |
| … |
… |
getpids()
|
| 504 | 510 | # warning in stdout |
| 505 | 511 | # return 4 - Program or service status is unknown |
| 506 | 512 | # |
| 507 | | # Dependencies: nice |
| | 513 | # Dependencies: nice, rm |
| 508 | 514 | # |
| 509 | 515 | # Todo: LSB says this should be called start_daemon |
| 510 | 516 | # LSB does not say that it should call evaluate_retval |
| … |
… |
loadproc()
|
| 567 | 573 | return 0 # 4 |
| 568 | 574 | ;; |
| 569 | 575 | 1) |
| 570 | | log_warning_msg "Unable to continue: ${pidfile} exists" |
| 571 | | return 0 # 4 |
| | 576 | boot_mesg "Removing stale pid file: ${pidfile}" ${WARNING} |
| | 577 | rm -f "${pidfile}" |
| 572 | 578 | ;; |
| 573 | 579 | 3) |
| 574 | 580 | ;; |
| … |
… |
loadproc()
|
| 598 | 604 | # warning in stdout |
| 599 | 605 | # return 4 - Unknown Status |
| 600 | 606 | # |
| 601 | | # Dependencies: kill |
| | 607 | # Dependencies: kill, rm |
| 602 | 608 | # |
| 603 | 609 | # Todo: LSB does not say that it should call evaluate_retval |
| 604 | 610 | # It checks for PIDFILE, which is deprecated. |
| … |
… |
killproc()
|
| 648 | 654 | pidofproc -s -p "${pidfile}" "${1}" |
| 649 | 655 | fi |
| 650 | 656 | |
| | 657 | # Remove stale pidfile |
| | 658 | if [ "$?" = 1 ]; then |
| | 659 | boot_mesg "Removing stale pid file: ${pidfile}." ${WARNING} |
| | 660 | rm -f "${pidfile}" |
| | 661 | fi |
| | 662 | |
| 651 | 663 | # If running, send the signal |
| 652 | 664 | if [ -n "${pidlist}" ]; then |
| 653 | 665 | for pid in ${pidlist} |