[LON-CAPA-cvs] cvs: loncom / lond

foxr lon-capa-cvs@mail.lon-capa.org
Tue, 23 Sep 2003 11:23:31 -0000


foxr		Tue Sep 23 07:23:31 2003 EDT

  Modified files:              
    /loncom	lond 
  Log:
  Comlplete implementation of reinit functionality.  Must still implement
  the actual initialization functionality, but the process can now
  receive the request and either invoke the appropriate internal function or
  signal the correct lonc.
  
  
Index: loncom/lond
diff -u loncom/lond:1.146 loncom/lond:1.147
--- loncom/lond:1.146	Tue Sep 16 06:28:14 2003
+++ loncom/lond	Tue Sep 23 07:23:31 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network
 # lond "LON Daemon" Server (port "LOND" 5663)
 #
-# $Id: lond,v 1.146 2003/09/16 10:28:14 foxr Exp $
+# $Id: lond,v 1.147 2003/09/23 11:23:31 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -60,6 +60,12 @@
 # 09/08/2003 Ron Fox:  Told lond to take care of change logging so we
 #      don't have to remember it:
 # $Log: lond,v $
+# Revision 1.147  2003/09/23 11:23:31  foxr
+# Comlplete implementation of reinit functionality.  Must still implement
+# the actual initialization functionality, but the process can now
+# receive the request and either invoke the appropriate internal function or
+# signal the correct lonc.
+#
 # Revision 1.146  2003/09/16 10:28:14  foxr
 # ReinitProcess - decode the process selector and produce the associated pid
 # filename.  Note: While it is possible to test that valid process selectors are
@@ -110,7 +116,7 @@
 my $status='';
 my $lastlog='';
 
-my $VERSION='$Revision: 1.146 $'; #' stupid emacs
+my $VERSION='$Revision: 1.147 $'; #' stupid emacs
 my $remoteVERSION;
 my $currenthostid;
 my $currentdomainid;
@@ -388,17 +394,25 @@
     #
     #
     my ($junk, $process) = split(":", $request);
-    my $processpidfile = $perlvar{'lonDaemons'}.'/';
+    my $processpidfile = $perlvar{'lonDaemons'}.'/logs/';
     if($process eq 'lonc') {
 	$processpidfile = $processpidfile."lonc.pid";
+	if (!open(PIDFILE, "< $processpidfile")) {
+	    return "error:Open failed for $processpidfile";
+	}
+	my $loncpid = <PIDFILE>;
+	close(PIDFILE);
+	logthis('<font color="red"> Reinitializing lonc pid='.$loncpid
+		."</font>");
+	kill("USR2", $loncpid);
     } elsif ($process eq 'lond') {
-	$processpidfile = $processpidfile."lond.pid";
+	logthis('<font color="red"> Reinitializing self (lond) </font>');
+	&UpdateHosts;			# Lond is us!!
     } else {
 	&logthis('<font color="yellow" Invalid reinit request for '.$process
 		 ."</font>");
 	return "error:Invalid process identifier $process";
     }
-    &logthis('<font color="red"> Reinitializing '.$process." </font>");
     return 'ok';
 }
 
@@ -548,6 +562,7 @@
 #     now be honored.
 #
 sub UpdateHosts {
+    logthis('<font color="blue"> Updating connections </font>');
 }
 
 sub checkchildren {