[LON-CAPA-cvs] cvs: loncom /init.d loncontrol

albertel lon-capa-cvs-allow@mail.lon-capa.org
Tue, 12 Jun 2007 23:45:42 -0000


albertel		Tue Jun 12 19:45:42 2007 EDT

  Modified files:              
    /loncom/init.d	loncontrol 
  Log:
  - give things a chance to cleanly exit on their own before killing 
  
  
Index: loncom/init.d/loncontrol
diff -u loncom/init.d/loncontrol:1.31 loncom/init.d/loncontrol:1.32
--- loncom/init.d/loncontrol:1.31	Fri Jun  1 23:40:02 2007
+++ loncom/init.d/loncontrol	Tue Jun 12 19:45:42 2007
@@ -1,6 +1,6 @@
 #!/usr/bin/perl
 #
-# $Id: loncontrol,v 1.31 2007/06/02 03:40:02 albertel Exp $
+# $Id: loncontrol,v 1.32 2007/06/12 23:45:42 albertel Exp $
 #
 # The LearningOnline Network with CAPA
 #
@@ -144,7 +144,10 @@
 	my $daemonpid=<PIDFILE>;
 	chomp($daemonpid);
 	kill TERM => $daemonpid;
-	sleep 1;
+	my $count=0;
+	while ($count++ < 5 && kill(0 => $daemonpid)) {
+	    sleep 1;
+	}
 	if (kill 0 => $daemonpid) {
 	    kill KILL => $daemonpid;
 	    sleep 1;