Diff for /loncom/Attic/lonc between versions 1.26 and 1.27

version 1.26, 2002/02/19 21:12:22 version 1.27, 2002/02/19 21:49:12
Line 80  $childmaxattempts=5; Line 80  $childmaxattempts=5;
   
 sub online {  sub online {
     my $host=shift;      my $host=shift;
     my $p=Net::Ping->new("tcp",10);      my $p=Net::Ping->new("tcp",20);
     my $online=$p->ping("$host");      my $online=$p->ping("$host");
     $p->close();      $p->close();
     undef ($p);      undef ($p);
Line 161  while ($configline=<CONFIG>) { Line 161  while ($configline=<CONFIG>) {
     my ($id,$domain,$role,$name,$ip)=split(/:/,$configline);      my ($id,$domain,$role,$name,$ip)=split(/:/,$configline);
     chomp($ip);      chomp($ip);
     $hostip{$id}=$ip;      $hostip{$id}=$ip;
       $hostname{$id}=$name;
 }  }
   
 close(CONFIG);  close(CONFIG);
   
 # -------------------------------------------------------- Routines for forking  # -------------------------------------------------------- Routines for forking
Line 185  sub REAPER {                        # ta Line 187  sub REAPER {                        # ta
     unlink($port);      unlink($port);
 }  }
   
 sub HUNTSMAN {                      # signal handler for SIGINT  sub hangup {
     local($SIG{CHLD}) = 'IGNORE';   # we're going to kill our children  
     foreach (keys %children) {      foreach (keys %children) {
         $wasserver=$children{$_};          $wasserver=$children{$_};
         &status("Closing $wasserver");          &status("Closing $wasserver");
Line 194  sub HUNTSMAN {                      # si Line 195  sub HUNTSMAN {                      # si
         &status("Kill PID $_ for $wasserver");          &status("Kill PID $_ for $wasserver");
  kill ('INT',$_);   kill ('INT',$_);
     }      }
   }
   
   sub HUNTSMAN {                      # signal handler for SIGINT
       local($SIG{CHLD}) = 'IGNORE';   # we're going to kill our children
       &hangup();
     my $execdir=$perlvar{'lonDaemons'};      my $execdir=$perlvar{'lonDaemons'};
     unlink("$execdir/logs/lonc.pid");      unlink("$execdir/logs/lonc.pid");
     &logthis("<font color=red>CRITICAL: Shutting down</font>");      &logthis("<font color=red>CRITICAL: Shutting down</font>");
Line 202  sub HUNTSMAN {                      # si Line 208  sub HUNTSMAN {                      # si
   
 sub HUPSMAN {                      # signal handler for SIGHUP  sub HUPSMAN {                      # signal handler for SIGHUP
     local($SIG{CHLD}) = 'IGNORE';  # we're going to kill our children      local($SIG{CHLD}) = 'IGNORE';  # we're going to kill our children
     foreach (keys %children) {      &hangup();
         $wasserver=$children{$_};  
         &status("Closing $wasserver");  
         &logthis('Closing '.$wasserver.': '.&subreply('exit',$wasserver));  
         &status("Kill PID $_ for $wasserver");  
  kill ('INT',$_);  
     }  
     &logthis("<font color=red>CRITICAL: Restarting</font>");      &logthis("<font color=red>CRITICAL: Restarting</font>");
     unlink("$execdir/logs/lonc.pid");      unlink("$execdir/logs/lonc.pid");
     my $execdir=$perlvar{'lonDaemons'};      my $execdir=$perlvar{'lonDaemons'};
Line 230  sub checkchildren { Line 230  sub checkchildren {
   
 sub USRMAN {  sub USRMAN {
     &logthis("USR1: Trying to establish connections again");      &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=();      %childatt=();
     &checkchildren();      &checkchildren();
 }  }

Removed from v.1.26  
changed lines
  Added in v.1.27


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>