Diff for /loncom/loncron between versions 1.35 and 1.41

version 1.35, 2002/11/27 17:14:26 version 1.41, 2003/07/30 16:49:27
Line 9 Line 9
 #  #
 # 7/14,7/15,7/19,7/21,7/22,11/18,  # 7/14,7/15,7/19,7/21,7/22,11/18,
 # 2/8 Gerd Kortemeyer  # 2/8 Gerd Kortemeyer
 # 12/6/2000,12/8 Scott Harrison  
 # 12/23 Gerd Kortemeyer  # 12/23 Gerd Kortemeyer
 # YEAR=2001  # YEAR=2001
 # 1/10/2001, 2/12/, 2/26, 3/15, 04/11, 04/21,8/27 Scott Harrison  
 # 09/04,09/06,11/26 Gerd Kortemeyer  # 09/04,09/06,11/26 Gerd Kortemeyer
 # YEAR=2002  
 # 5/11/2002 Scott Harrison  
   
 $|=1;  $|=1;
   
Line 135  $date=localtime($now); Line 131  $date=localtime($now);
   
 {  {
 my $fh=IO::File->new(">$statusdir/newstatus.html");  my $fh=IO::File->new(">$statusdir/newstatus.html");
   my %simplestatus=();
   
 print $fh (<<ENDHEADERS);  print $fh (<<ENDHEADERS);
 <html>  <html>
Line 220  while ($line=<DFH>) { Line 217  while ($line=<DFH>) {
    } elsif ($usage>60) {     } elsif ($usage>60) {
       $notices++;        $notices++;
    }     }
    if ($usage>95) { $warnings++; $warnings++ }     if ($usage>95) { $warnings++; $warnings++; $simplestatus{'diskfull'}++; }
 }  }
 close (DFH);  close (DFH);
 print $fh "</pre>";  print $fh "</pre>";
Line 320  print $fh "</pre>"; Line 317  print $fh "</pre>";
 # ---------------------------------------------------------------------- lonsql  # ---------------------------------------------------------------------- lonsql
   
 my $restartflag=1;  my $restartflag=1;
 if ($perlvar{'lonRole'} eq "library") {  
   
     print $fh '<hr><a name="lonsql"><h2>lonsql</h2><h3>Log</h3><pre>';      print $fh '<hr><a name="lonsql"><h2>lonsql</h2><h3>Log</h3><pre>';
     print "lonsql\n";      print "lonsql\n";
     if (-e "$perlvar{'lonDaemons'}/logs/lonsql.log"){      if (-e "$perlvar{'lonDaemons'}/logs/lonsql.log"){
Line 356  if ($perlvar{'lonRole'} eq "library") { Line 351  if ($perlvar{'lonRole'} eq "library") {
  }   }
     }      }
     if ($restartflag==1) {      if ($restartflag==1) {
    $simplestatus{'lonsql'}='off';
  $errors++;   $errors++;
          print $fh '<br><font color="red">Killall lonsql: '.           print $fh '<br><font color="red">Killall lonsql: '.
                     system('killall lonsql').' - ';                      system('killall lonsql').' - ';
Line 375  if ($perlvar{'lonRole'} eq "library") { Line 371  if ($perlvar{'lonRole'} eq "library") {
     sleep 2;      sleep 2;
     if (kill 0 => $lonsqlpid) {      if (kill 0 => $lonsqlpid) {
  print $fh "<h3>lonsql at pid $lonsqlpid responding</h3>";   print $fh "<h3>lonsql at pid $lonsqlpid responding</h3>";
    $simplestatus{'lonsql'}='restarted';
     } else {      } else {
  $errors++; $errors++;   $errors++; $errors++;
  print $fh "<h3>lonsql at pid $lonsqlpid not responding</h3>";   print $fh "<h3>lonsql at pid $lonsqlpid not responding</h3>";
Line 407  if ($perlvar{'lonRole'} eq "library") { Line 404  if ($perlvar{'lonRole'} eq "library") {
  $atime,$mtime,$ctime,   $atime,$mtime,$ctime,
  $blksize,$blocks)=stat($fname);   $blksize,$blocks)=stat($fname);
   
     if ($size>40000) {      if ($size>200000) {
  print $fh "Rotating logs ...<p>";   print $fh "Rotating logs ...<p>";
  rename("$fname.2","$fname.3");   rename("$fname.2","$fname.3");
  rename("$fname.1","$fname.2");   rename("$fname.1","$fname.2");
Line 415  if ($perlvar{'lonRole'} eq "library") { Line 412  if ($perlvar{'lonRole'} eq "library") {
     }      }
   
     &errout($fh);      &errout($fh);
 }  
 # ------------------------------------------------------------------------ lond  # ------------------------------------------------------------------------ lond
   
 print $fh '<hr><a name="lond"><h2>lond</h2><h3>Log</h3><pre>';  print $fh '<hr><a name="lond"><h2>lond</h2><h3>Log</h3><pre>';
Line 453  if (-e $londfile) { Line 449  if (-e $londfile) {
    }     }
 }   } 
 if ($restartflag==1) {  if ($restartflag==1) {
       $simplestatus{'lond'}='off';
    $errors++;     $errors++;
   print $fh '<br><font color="red">Killall lond: '.    print $fh '<br><font color="red">Killall lond: '.
                     system('killall lond').' - ';                      system('killall lond').' - ';
Line 471  if ($restartflag==1) { Line 468  if ($restartflag==1) {
        sleep 2;         sleep 2;
        if (kill 0 => $londpid) {         if (kill 0 => $londpid) {
           print $fh "<h3>lond at pid $londpid responding</h3>";            print $fh "<h3>lond at pid $londpid responding</h3>";
     $simplestatus{'lond'}='restarted';
        } else {         } else {
           $errors++; $errors++;            $errors++; $errors++;
           print $fh "<h3>lond at pid $londpid not responding</h3>";            print $fh "<h3>lond at pid $londpid not responding</h3>";
Line 549  if (-e $loncfile) { Line 547  if (-e $loncfile) {
    }     }
 }   } 
 if ($restartflag==1) {  if ($restartflag==1) {
       $simplestatus{'lonc'}='off';
    $errors++;     $errors++;
   print $fh '<br><font color="red">Killall lonc: '.    print $fh '<br><font color="red">Killall lonc: '.
             system('killall lonc').' - ';              system('killall lonc').' - ';
Line 567  if ($restartflag==1) { Line 566  if ($restartflag==1) {
        sleep 2;         sleep 2;
        if (kill 0 => $loncpid) {         if (kill 0 => $loncpid) {
           print $fh "<h3>lonc at pid $loncpid responding</h3>";            print $fh "<h3>lonc at pid $loncpid responding</h3>";
     $simplestatus{'lonc'}='restarted';
        } else {         } else {
           $errors++; $errors++;            $errors++; $errors++;
           print $fh "<h3>lonc at pid $loncpid not responding</h3>";            print $fh "<h3>lonc at pid $loncpid not responding</h3>";
Line 645  if (-e $lonhttpdfile) { Line 645  if (-e $lonhttpdfile) {
    }     }
 }   } 
 if ($restartflag==1) {  if ($restartflag==1) {
       $simplestatus{'lonhttpd'}='off';
    $errors++;     $errors++;
   print $fh '<br><font color="red">Killall lonhttpd: '.    print $fh '<br><font color="red">Killall lonhttpd: '.
             system('killall lonhttpd').' - ';              system('killall lonhttpd').' - ';
Line 663  if ($restartflag==1) { Line 664  if ($restartflag==1) {
        sleep 2;         sleep 2;
        if (kill 0 => $lonhttpdpid) {         if (kill 0 => $lonhttpdpid) {
           print $fh "<h3>lonhttpd at pid $lonhttpdpid responding</h3>";            print $fh "<h3>lonhttpd at pid $lonhttpdpid responding</h3>";
     $simplestatus{'lonhttpd'}='restarted';
        } else {         } else {
           $errors++; $errors++;            $errors++; $errors++;
           print $fh "<h3>lonhttpd at pid $lonhttpdpid not responding</h3>";            print $fh "<h3>lonhttpd at pid $lonhttpdpid not responding</h3>";
Line 786  $unsend=0; Line 788  $unsend=0;
 print $fh "Total unsend messages: <b>$unsend</b><p>\n";  print $fh "Total unsend messages: <b>$unsend</b><p>\n";
 $warnings=$warnings+5*$unsend;  $warnings=$warnings+5*$unsend;
   
   if ($unsend) { $simplestatus{'unsend'}=$unsend; }
 print $fh "<h3>Outgoing Buffer</h3>";  print $fh "<h3>Outgoing Buffer</h3>";
   
 open (DFH,"ls -lF $perlvar{'lonSockDir'}/delayed|");  open (DFH,"ls -lF $perlvar{'lonSockDir'}/delayed|");
Line 803  $now=time; Line 806  $now=time;
 $date=localtime($now);  $date=localtime($now);
 print $fh "<hr>$date ($now)</body></html>\n";  print $fh "<hr>$date ($now)</body></html>\n";
 print "writing done\n";  print "writing done\n";
   $fh->close();
 }  }
   if ($errors) { $simplestatus{'errors'}=$errors; }
   if ($warnings) { $simplestatus{'warnings'}=$warnings; }
   if ($notices) { $simplestatus{'notices'}=$notices; }
   $simplestatus{'time'}=time;
   
 rename ("$statusdir/newstatus.html","$statusdir/index.html");  rename ("$statusdir/newstatus.html","$statusdir/index.html");
   {
   my $sfh=IO::File->new(">$statusdir/loncron_simple.txt");
   foreach (keys %simplestatus) {
       print $sfh $_.'='.$simplestatus{$_}.'&';
   }
   print $sfh "\n";
   $sfh->close();
   }
 if ($totalcount>200) {  if ($totalcount>200) {
    print "mailing\n";     print "mailing\n";
    $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}";     $emailto="$perlvar{'lonAdmEMail'}";
      if ($totalcount>1000) {
         $emailto.=",$perlvar{'lonSysEMail'}";
      }
    $subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices";      $subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices"; 
    system(     system(
  "metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html");   "metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html");

Removed from v.1.35  
changed lines
  Added in v.1.41


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