--- loncom/Attic/lonc 2002/02/19 21:12:22 1.26 +++ loncom/Attic/lonc 2002/02/19 21:49:12 1.27 @@ -5,7 +5,7 @@ # provides persistent TCP connections to the other servers in the network # through multiplexed domain sockets # -# $Id: lonc,v 1.26 2002/02/19 21:12:22 www Exp $ +# $Id: lonc,v 1.27 2002/02/19 21:49:12 www Exp $ # # Copyright Michigan State University Board of Trustees # @@ -80,7 +80,7 @@ $childmaxattempts=5; sub online { my $host=shift; - my $p=Net::Ping->new("tcp",10); + my $p=Net::Ping->new("tcp",20); my $online=$p->ping("$host"); $p->close(); undef ($p); @@ -161,7 +161,9 @@ while ($configline=) { my ($id,$domain,$role,$name,$ip)=split(/:/,$configline); chomp($ip); $hostip{$id}=$ip; + $hostname{$id}=$name; } + close(CONFIG); # -------------------------------------------------------- Routines for forking @@ -185,8 +187,7 @@ sub REAPER { # ta unlink($port); } -sub HUNTSMAN { # signal handler for SIGINT - local($SIG{CHLD}) = 'IGNORE'; # we're going to kill our children +sub hangup { foreach (keys %children) { $wasserver=$children{$_}; &status("Closing $wasserver"); @@ -194,6 +195,11 @@ sub HUNTSMAN { # si &status("Kill PID $_ for $wasserver"); kill ('INT',$_); } +} + +sub HUNTSMAN { # signal handler for SIGINT + local($SIG{CHLD}) = 'IGNORE'; # we're going to kill our children + &hangup(); my $execdir=$perlvar{'lonDaemons'}; unlink("$execdir/logs/lonc.pid"); &logthis("CRITICAL: Shutting down"); @@ -202,13 +208,7 @@ sub HUNTSMAN { # si sub HUPSMAN { # signal handler for SIGHUP local($SIG{CHLD}) = 'IGNORE'; # we're going to kill our children - foreach (keys %children) { - $wasserver=$children{$_}; - &status("Closing $wasserver"); - &logthis('Closing '.$wasserver.': '.&subreply('exit',$wasserver)); - &status("Kill PID $_ for $wasserver"); - kill ('INT',$_); - } + &hangup(); &logthis("CRITICAL: Restarting"); unlink("$execdir/logs/lonc.pid"); my $execdir=$perlvar{'lonDaemons'}; @@ -230,12 +230,6 @@ sub checkchildren { sub USRMAN { &logthis("USR1: Trying to establish connections again"); - foreach $thisserver (keys %hostip) { - $answer=subreply("ping",$thisserver); - &logthis("USR1: Ping $thisserver " - ."(pid >$childpid{$thisserver}<, $childatt{thisserver} attempts): " - ." >$answer<"); - } %childatt=(); &checkchildren(); }