Diff for /loncom/Attic/lonc between versions 1.16 and 1.17

version 1.16, 2001/06/12 15:32:38 version 1.17, 2001/08/30 20:02:28
Line 41  sub catchexception { Line 41  sub catchexception {
     die($@);      die($@);
 }  }
   
 $childmaxattempts=10;  $childmaxattempts=5;
   
 # -------------------------------- Set signal handlers to record abnormal exits  # -------------------------------- Set signal handlers to record abnormal exits
   
Line 116  sub REAPER {                        # ta Line 116  sub REAPER {                        # ta
   
 sub HUNTSMAN {                      # signal handler for SIGINT  sub HUNTSMAN {                      # signal handler for SIGINT
     local($SIG{CHLD}) = 'IGNORE';   # we're going to kill our children      local($SIG{CHLD}) = 'IGNORE';   # we're going to kill our children
     kill 'INT' => keys %children;      map {
           $wasserver=$children{$_};
           &logthis('Closing '.$wasserver.': '.&subreply('exit',$wasserver));
    kill ('INT',$_);
       } keys %children;
     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 125  sub HUNTSMAN {                      # si Line 129  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
     kill 'INT' => keys %children;      map {
           $wasserver=$children{$_};
           &logthis('Closing '.$wasserver.': '.&subreply('exit',$wasserver));
    kill ('INT',$_);
       } keys %children;
     &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 222  while (1) { Line 230  while (1) {
                                     # See who died and start new one                                      # See who died and start new one
     foreach $thisserver (keys %hostip) {      foreach $thisserver (keys %hostip) {
         if (!$childpid{$thisserver}) {          if (!$childpid{$thisserver}) {
     if ($childatt{$thisserver}<=$childmaxattempts) {      if ($childatt{$thisserver}<$childmaxattempts) {
        $childatt{$thisserver}++;         $childatt{$thisserver}++;
                &logthis(                 &logthis(
    "<font color=yellow>INFO: Trying to reconnect for $thisserver "     "<font color=yellow>INFO: Trying to reconnect for $thisserver "
Line 287  print $remotesock "$answer"; Line 295  print $remotesock "$answer";
 $answer=<$remotesock>;  $answer=<$remotesock>;
 chomp($answer);  chomp($answer);
 &logthis("Init reply for $conserver: >$answer<");  &logthis("Init reply for $conserver: >$answer<");
   if ($answer ne 'ok') {
          my $st=120+int(rand(240));
          &logthis(
   "<font color=blue>WARNING: Init failed $conserver ($st secs)</font>");
          sleep($st);
          exit; 
   }
 sleep 5;  sleep 5;
 print $remotesock "pong\n";  print $remotesock "pong\n";
 $answer=<$remotesock>;  $answer=<$remotesock>;

Removed from v.1.16  
changed lines
  Added in v.1.17


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