[Pkg-sysvinit-commits] r1196 - in sysvinit/trunk/debian: . initscripts/etc/init.d
pere at alioth.debian.org
pere at alioth.debian.org
Fri Jan 4 23:12:51 UTC 2008
Author: pere
Date: 2008-01-04 23:12:51 +0000 (Fri, 04 Jan 2008)
New Revision: 1196
Modified:
sysvinit/trunk/debian/changelog
sysvinit/trunk/debian/initscripts/etc/init.d/killprocs
Log:
* Change initd/killprocs to use same optimization as sendsigs, to
avoid having to wait 5 seconds if there is no more processes.
Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog 2008-01-04 23:07:51 UTC (rev 1195)
+++ sysvinit/trunk/debian/changelog 2008-01-04 23:12:51 UTC (rev 1196)
@@ -44,6 +44,8 @@
#459146). Based on patch from Kel Modderman.
* Change init.d/bootlogd to not report failure when trying to stop
an already stopped bootlogd.
+ * Change initd/killprocs to use same optimization as sendsigs, to
+ avoid having to wait 5 seconds if there is no more processes.
-- Petter Reinholdtsen <pere at debian.org> Mon, 31 Dec 2007 12:18:42 +0100
Modified: sysvinit/trunk/debian/initscripts/etc/init.d/killprocs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/killprocs 2008-01-04 23:07:51 UTC (rev 1195)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/killprocs 2008-01-04 23:12:51 UTC (rev 1196)
@@ -14,14 +14,35 @@
do_start () {
# Kill all processes.
- log_action_begin_msg "Sending all processes the TERM signal"
- killall5 -15
+ log_action_begin_msg "Asking all remaining processes to terminate"
+ killall5 -15 # SIGTERM
log_action_end_msg 0
- sleep 5
- log_action_begin_msg "Sending all processes the KILL signal"
- killall5 -9
- log_action_end_msg 0
+ alldead=""
+ for seq in 1 2 3 4 5 6 7 8 9 10; do
+ # use SIGCONT/signal 18 to check if there are
+ # processes left. No need to check the exit code
+ # value, because either killall5 work and it make
+ # sense to wait for processes to die, or it fail and
+ # there is nothing to wait for.
+
+ if killall5 -18 ; then
+ :
+ else
+ alldead=1
+ break
+ fi
+ sleep 1
+ done
+ if [ -z "$alldead" ] ; then
+ log_action_begin_msg "Killing all remaining processes"
+ killall5 -9 # SIGKILL
+ log_action_end_msg 1
+ else
+ log_action_begin_msg "All processes ended within $seq seconds."
+ log_action_end_msg 0
+ fi
+
# We start update here, since we just killed it.
if [ -x /sbin/update ] && [ "$(uname -s)" = Linux ]
then
More information about the Pkg-sysvinit-commits
mailing list