[Pkg-sysvinit-commits] r1838 - in sysvinit/trunk/debian: . src/initscripts/etc/init.d

Petter Reinholdtsen pere at alioth.debian.org
Sun Mar 21 09:10:28 UTC 2010


Author: pere
Date: 2010-03-21 09:10:22 +0000 (Sun, 21 Mar 2010)
New Revision: 1838

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/src/initscripts/etc/init.d/sendsigs
Log:
Avoid killing processes managed by upstart, and print list of
misbehaving processes.  Partly based on patch from Martin Pitt,
Scott James Remnant and Ubuntu.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2010-03-21 07:20:51 UTC (rev 1837)
+++ sysvinit/trunk/debian/changelog	2010-03-21 09:10:22 UTC (rev 1838)
@@ -1,3 +1,11 @@
+sysvinit (2.87dsf-10) UNRELEASED; urgency=low
+
+  * Avoid killing processes managed by upstart, and print list of
+    misbehaving processes.  Partly based on patch from Martin Pitt,
+    Scott James Remnant and Ubuntu.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Sun, 21 Mar 2010 10:00:15 +0100
+
 sysvinit (2.87dsf-9) unstable; urgency=low
 
   [ Petter Reinholdtsen ]

Modified: sysvinit/trunk/debian/src/initscripts/etc/init.d/sendsigs
===================================================================
--- sysvinit/trunk/debian/src/initscripts/etc/init.d/sendsigs	2010-03-21 07:20:51 UTC (rev 1837)
+++ sysvinit/trunk/debian/src/initscripts/etc/init.d/sendsigs	2010-03-21 09:10:22 UTC (rev 1838)
@@ -13,6 +13,17 @@
 
 . /lib/lsb/init-functions
 
+# Make it possible to see who the misbehaving processes are
+report_unkillable() {
+	if [ -x /usr/bin/pstree ] ; then
+		echo "Currently running processes (pstree):"
+		pstree
+	elsif [ -x /bin/ps ] ; then
+		echo "Currently running processes (ps):"
+		ps -ef
+	fi
+}
+
 do_stop () {
 	OMITPIDS=
 
@@ -38,6 +49,13 @@
 		done
 	fi
 
+	# Upstart jobs have their own "stop on" clauses that sends
+	# SIGTERM/SIGKILL just like this, so if they're still running,
+	# they're supposed to be
+	for pid in $(initctl list | sed -n -e "/process [0-9]/s/.*process //p"); do
+		OMITPIDS="${OMITPIDS:+$OMITPIDS }-o $pid"
+	done
+
 	# Flush the kernel I/O buffer before we start to kill
 	# processes, to make sure the IO of already stopped services to
 	# not slow down the remaining processes to a point where they
@@ -67,6 +85,7 @@
 		sleep 1
 	done
 	if [ -z "$alldead" ] ; then
+	    report_unkillable
 	    log_action_begin_msg "Killing all remaining processes"
 	    killall5 -9 $OMITPIDS # SIGKILL
 	    log_action_end_msg 1




More information about the Pkg-sysvinit-commits mailing list