--- loncom/loncron 2007/05/31 05:20:18 1.74 +++ loncom/loncron 2014/03/17 14:47:38 1.100 @@ -2,7 +2,7 @@ # Housekeeping program, started by cron, loncontrol and loncron.pl # -# $Id: loncron,v 1.74 2007/05/31 05:20:18 albertel Exp $ +# $Id: loncron,v 1.100 2014/03/17 14:47:38 bisitz Exp $ # # Copyright Michigan State University Board of Trustees # @@ -32,7 +32,10 @@ use strict; use lib '/home/httpd/lib/perl/'; use LONCAPA::Configuration; +use LONCAPA::Checksumming; +use LONCAPA; use Apache::lonnet; +use Apache::loncommon; use IO::File; use IO::Socket; @@ -268,12 +271,7 @@ sub log_machine_info { &log($fh,"
"); - open(DSH,"$perlvar{'lonDaemons'}/distprobe |"); - while (my $line="); &errout($fh); @@ -304,7 +302,6 @@ sub start_logging {) { - &log($fh,&encode_entities($line,'<>&"')); - $psproc++; - } - close(DSH); + &log($fh,&encode_entities(&LONCAPA::distro(),'<>&"')); &log($fh,"
'); - - open (DFH,"tail -n25 /etc/httpd/logs/access_log|"); - while (my $line=) { &log($fh,&encode_entities($line,'<>&"')) }; - close (DFH); - - &log($fh,"
"); - - open (DFH,"tail -n25 /etc/httpd/logs/error_log|"); - while (my $line="); &errout($fh); } @@ -443,7 +526,7 @@ sub check_httpd_logs { sub rotate_lonnet_logs { my ($fh)=@_; &log($fh,') { - &log($fh,"$line"); - if ($line=~/\[error\]/) { $notices++; } + if (open(PIPE,"./lchttpdlogs|")) { + while (my $line= ) { + &log($fh,$line); + if ($line=~/\[error\]/) { $notices++; } + } + close(PIPE); } - close (DFH); - &log($fh,"
'); - print "checking logs\n"; + print "Checking logs.\n"; if (-e "$perlvar{'lonDaemons'}/logs/lonnet.log"){ open (DFH,"tail -n50 $perlvar{'lonDaemons'}/logs/lonnet.log|"); while (my $line=) { @@ -470,19 +553,24 @@ sub rotate_lonnet_logs { sub rotate_other_logs { my ($fh) = @_; - my $fname="$perlvar{'lonDaemons'}/logs/autoenroll.log"; - &rotate_logfile($fname,$fh,'Auto Enroll log'); - $fname="$perlvar{'lonDaemons'}/logs/autocreate.log"; - &rotate_logfile($fname,$fh,'Create Course log'); - $fname="$perlvar{'lonDaemons'}/logs/searchcat.log"; - &rotate_logfile($fname,$fh,'Search Cataloguing log'); + my %logs = ( + autoenroll => 'Auto Enroll log', + autocreate => 'Create Course log', + searchcat => 'Search Cataloguing log', + autoupdate => 'Auto Update log', + refreshcourseids_db => 'Refresh CourseIDs db log', + ); + foreach my $item (keys(%logs)) { + my $fname=$perlvar{'lonDaemons'}.'/logs/'.$item.'.log'; + &rotate_logfile($fname,$fh,$logs{$item}); + } } # ----------------------------------------------------------------- Connections sub test_connections { my ($fh)=@_; &log($fh,' Connections
'); - print "testing connections\n"; + print "Testing connections.\n"; &log($fh,"