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

foxr lon-capa-cvs@mail.lon-capa.org
Wed, 02 Jul 2003 01:31:55 -0000


foxr		Tue Jul  1 21:31:55 2003 EDT

  Modified files:              
    /loncom	loncnew 
  Log:
  Added kill -HUP logic (restart).
  
  
  
Index: loncom/loncnew
diff -u loncom/loncnew:1.12 loncom/loncnew:1.13
--- loncom/loncnew:1.12	Tue Jul  1 21:12:35 2003
+++ loncom/loncnew	Tue Jul  1 21:31:55 2003
@@ -2,7 +2,7 @@
 # The LearningOnline Network with CAPA
 # lonc maintains the connections to remote computers
 #
-# $Id: loncnew,v 1.12 2003/07/02 01:12:35 foxr Exp $
+# $Id: loncnew,v 1.13 2003/07/02 01:31:55 foxr Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -46,10 +46,8 @@
 
 # Change log:
 #    $Log: loncnew,v $
-#    Revision 1.12  2003/07/02 01:12:35  foxr
-#    - Add some debugging to killthemall
-#    - Add better error handling to LondReadable
-#    - Remove tick logging in the timer handler.
+#    Revision 1.13  2003/07/02 01:31:55  foxr
+#    Added kill -HUP logic (restart).
 #
 #    Revision 1.11  2003/06/25 01:54:44  foxr
 #    Fix more problems with transaction failure.
@@ -1434,7 +1432,7 @@
 
 $SIG{INT}  = \&KillThemAll;
 $SIG{TERM} = \&KillThemAll; 
-
+$SIG{HUP}  = \&Restart;
 
 while(1) {
     $deadchild = wait();
@@ -1446,6 +1444,24 @@
 	Log("INFO", "Restarting child procesing ".$deadhost);
 	CreateChild($deadhost);
     }
+}
+
+=pod
+
+=head1 Restart
+
+Signal handler for HUP... all children are killed and
+we self restart.  This is an el-cheapo way to re read
+the config file.
+
+=cut
+
+sub Restart {
+    KillThemAll;		# First kill all the children.
+    Log("CRITICAL", "Restarting");
+    my $execdir = $perlvar{'lonDaemons'};
+    unlink("$execdir/logs/lonc.pid");
+    exec("$execdir/lonc");
 }
 
 =pod