Diff for /loncom/loncron between versions 1.95.10.1 and 1.96

version 1.95.10.1, 2012/02/17 22:47:39 version 1.96, 2013/02/02 00:22:30
Line 32  use strict; Line 32  use strict;
   
 use lib '/home/httpd/lib/perl/';  use lib '/home/httpd/lib/perl/';
 use LONCAPA::Configuration;  use LONCAPA::Configuration;
   use LONCAPA::Checksumming;
 use LONCAPA;  use LONCAPA;
 use Apache::lonnet;  use Apache::lonnet;
 use Apache::loncommon;  use Apache::loncommon;
Line 270  sub log_machine_info { Line 271  sub log_machine_info {
   
     &log($fh,"<h3>distprobe</h3>");      &log($fh,"<h3>distprobe</h3>");
     &log($fh,"<pre>");      &log($fh,"<pre>");
     open(DSH,"$perlvar{'lonDaemons'}/distprobe |");      &get_distro($perlvar{'lonDaemons'},$fh);
     while (my $line=<DSH>) {   
  &log($fh,&encode_entities($line,'<>&"'));   
  $psproc++;  
     }  
     close(DSH);  
     &log($fh,"</pre>");      &log($fh,"</pre>");
   
     &errout($fh);      &errout($fh);
Line 755  sub write_serverhomeIDs { Line 751  sub write_serverhomeIDs {
     return;      return;
 }  }
   
   sub write_checksums {
       my ($perlvar) = @_;
       return unless (ref($perlvar) eq 'HASH');
       my $distro = &get_distro($perlvar->{'lonDaemons'});
       if ($distro) {
           print "Retrieving file version and checksumming.\n";
           my ($chksumsref,$versionsref) =
               &LONCAPA::Checksumming::get_checksums($distro,$perlvar->{'lonDaemons'},
                                                     $perlvar->{'lonLib'},
                                                     $perlvar->{'lonIncludes'},
                                                     $perlvar->{'lonTabDir'});
           if (ref($chksumsref) eq 'HASH') {
               $numchksums = scalar(keys(%{$chksumsref}));
           }
           print "File version retrieved and checksumming completed for $numchksums files.\n";
       } else {
           print "File version retrieval and checksumming skipped - could not determine Linux distro.\n"; 
       }
       return'
   }
   
 sub send_mail {  sub send_mail {
     print "sending mail\n";      print "sending mail\n";
     my $defdom = $perlvar{'lonDefDomain'};      my $defdom = $perlvar{'lonDefDomain'};
Line 772  sub send_mail { Line 789  sub send_mail {
     }      }
 }  }
   
   sub get_distro {
       my ($dir,$fh) = @_;
       my $distro;
       if (open(my $disth,"$dir/distprobe |")) {
           while (my $line=<$disth>) {
               if ($fh) {
                   &log($fh,&encode_entities($line,'<>&"'));
               }
               $distro .= $line;
           }
           close($disth);
       }
       return $distro;
   }
   
 sub usage {  sub usage {
     print(<<USAGE);      print(<<USAGE);
 loncron - housekeeping program that checks up on various parts of Lon-CAPA  loncron - housekeeping program that checks up on various parts of Lon-CAPA
Line 812  sub main () { Line 844  sub main () {
     undef $perlvarref;      undef $perlvarref;
     delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed      delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed
     delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed      delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed
     delete $perlvar{'reCAPTCHA_PRIVATE'}; # remove since sensitive and not needed   
     delete $perlvar{'reCAPTCHA_PUBLIC'}; # remove since sensitive and not needed  
     chdir($perlvar{'lonDaemons'});      chdir($perlvar{'lonDaemons'});
 # --------------------------------------- Make sure that LON-CAPA is configured  # --------------------------------------- Make sure that LON-CAPA is configured
 # I only test for one thing here (lonHostID).  This is just a safeguard.  # I only test for one thing here (lonHostID).  This is just a safeguard.
Line 907  sub main () { Line 937  sub main () {
  &log_simplestatus();   &log_simplestatus();
         &write_loncaparevs();          &write_loncaparevs();
         &write_serverhomeIDs();          &write_serverhomeIDs();
    &write_checksums(\%perlvar);
  if ($totalcount>200 && !$noemail) { &send_mail(); }   if ($totalcount>200 && !$noemail) { &send_mail(); }
     }      }
 }  }
Line 915  sub main () { Line 945  sub main () {
 &main();  &main();
 1;  1;
   
   
   
   
   
   
   
   

Removed from v.1.95.10.1  
changed lines
  Added in v.1.96


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