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

albertel lon-capa-cvs@mail.lon-capa.org
Thu, 19 Aug 2004 18:31:42 -0000


albertel		Thu Aug 19 14:31:42 2004 EDT

  Modified files:              
    /loncom/init.d	loncontrol 
  Log:
  - trying to double check after a stop that all daemons are really gone
  
  
Index: loncom/init.d/loncontrol
diff -u loncom/init.d/loncontrol:1.18 loncom/init.d/loncontrol:1.19
--- loncom/init.d/loncontrol:1.18	Tue May 11 17:22:04 2004
+++ loncom/init.d/loncontrol	Thu Aug 19 14:31:42 2004
@@ -23,7 +23,7 @@
 $ENV{'BASH_ENV'}="";
 
 sub stop_daemon {
-    my ($daemon)=@_;
+    my ($daemon,$killallname)=@_;
     my $pidfile="/home/httpd/perl/logs/$daemon.pid";
     
     printf("%-10s ",$daemon);
@@ -37,22 +37,29 @@
 	    kill KILL => $daemonpid;
 	    sleep 2;
 	    if (kill 0 => $daemonpid) {
-		print("failed to kill\n"); return;
+		print("failed to kill");
 	    } else {
-		print("killed\n"); return;
+		print("killed");
 	    }
 	} else {
-	    print("stopped\n"); return;
+	    print("stopped");
 	}
+    } else {
+	print("not running");
+    }
+    system("killall -q -0 $killallname");
+    if ($? == 0) {
+	system("killall -q $killallname");
+	print(", killed off extraneous processes");
     }
-    print("not running\n");
+    print("\n");
 }
 
 if (($command eq "restartold") or ($command eq "reloadold")) {
     print 'Restarting LON-CAPA'."\n";
     print 'Ending LON-CAPA client and daemon processes'."\n";
     foreach my $daemon ('lonsql','lond','lonc','lonhttpd') {
-	&stop_daemon($daemon);
+	&stop_daemon($daemon,$daemon);
     }
     print 'Starting LON-CAPA client and daemon processes (please be patient)'.
 	"\n";
@@ -61,7 +68,9 @@
     print 'Restarting LON-CAPA'."\n";
     print 'Ending LON-CAPA client and daemon processes'."\n";
     foreach my $daemon ('lonsql','lond','lonc','lonhttpd') {
-	&stop_daemon($daemon);
+	my $killallname=$daemon;
+	if ($daemon eq 'lonc') { $killallname='loncnew'; }
+	&stop_daemon($daemon,$killallname);
     }
     print 'Starting LON-CAPA client and daemon processes (please be patient)'.
 	"\n";
@@ -69,7 +78,9 @@
 } elsif ($command eq "stop") {
     print 'Stopping LON-CAPA'."\n";
     foreach my $daemon ('lonsql','lond','lonc','lonhttpd') {
-	&stop_daemon($daemon);
+	my $killallname=$daemon;
+	if ($daemon eq 'lonc') { $killallname='loncnew'; }
+	&stop_daemon($daemon,$killallname);
     }
 } elsif ($command eq "startold") {
     print 'Starting LON-CAPA'."\n";