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

pere at alioth.debian.org pere at alioth.debian.org
Thu Jan 3 23:26:16 UTC 2008


Author: pere
Date: 2008-01-03 23:26:16 +0000 (Thu, 03 Jan 2008)
New Revision: 1187

Modified:
   sysvinit/trunk/debian/changelog
   sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs
Log:
  * Extend init.d/sendsigs to sync before killing processes, and to
    detect and report if it had to use SIGKILL to terminate processes.
    Report using SIGKILL as a failure.  Based on ideas from Gabor
    Gombas.

Modified: sysvinit/trunk/debian/changelog
===================================================================
--- sysvinit/trunk/debian/changelog	2008-01-03 23:05:58 UTC (rev 1186)
+++ sysvinit/trunk/debian/changelog	2008-01-03 23:26:16 UTC (rev 1187)
@@ -22,6 +22,10 @@
     be redundant.
   * Extend waiting time of init.d/sendsigs from 0-5 seconds to 0-10
     seconds, to give slow processes more time to shut down properly.
+  * Extend init.d/sendsigs to sync before killing processes, and to
+    detect and report if it had to use SIGKILL to terminate processes.
+    Report using SIGKILL as a failure.  Based on ideas from Gabor
+    Gombas.
 
  -- Petter Reinholdtsen <pere at debian.org>  Mon, 31 Dec 2007 12:18:42 +0100
 

Modified: sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs
===================================================================
--- sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs	2008-01-03 23:05:58 UTC (rev 1186)
+++ sysvinit/trunk/debian/initscripts/etc/init.d/sendsigs	2008-01-03 23:26:16 UTC (rev 1187)
@@ -22,23 +22,42 @@
 		done
 	fi
 
+	# Flush the kernel I/O buffer before we start to kill
+	# processes, to make sure the IO of alrady stopped services to
+	# not slow down the remaining processes to a point where they
+	# are accidentily killed with SIGKILL because they did not
+	# manage to shut down in time.
+	sync
+
 	# Kill all processes.
 	log_action_begin_msg "Asking all remaining processes to terminate"
 	killall5 -15 $OMITPIDS # SIGTERM
 	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.
-		killall5 -18 $OMITPIDS || break
+		
+		if killall5 -18 $OMITPIDS ; then
+		    :
+		else
+		    alldead=1
+		    break
+		fi
 
 		sleep 1
 	done
-	log_action_begin_msg "Killing all remaining processes"
-	killall5 -9 $OMITPIDS # SIGKILL
-	log_action_end_msg 0
+	if [ -z "$alldead" ] ; then
+	    log_action_begin_msg "Killing all remaining processes"
+	    killall5 -9 $OMITPIDS # SIGKILL
+	    log_action_end_msg 1
+	else
+	    log_action_begin_msg "All remaining processes terminated, no need to use SIGKILL"
+	    log_action_end_msg 0
+	fi
 }
 
 splash_back() {




More information about the Pkg-sysvinit-commits mailing list