--- loncom/loncron 2004/05/11 19:15:03 1.47
+++ loncom/loncron 2005/10/06 20:35:50 1.61
@@ -2,7 +2,7 @@
# Housekeeping program, started by cron, loncontrol and loncron.pl
#
-# $Id: loncron,v 1.47 2004/05/11 19:15:03 albertel Exp $
+# $Id: loncron,v 1.61 2005/10/06 20:35:50 albertel Exp $
#
# Copyright Michigan State University Board of Trustees
#
@@ -28,13 +28,15 @@
#
$|=1;
+use strict;
use lib '/home/httpd/lib/perl/';
use LONCAPA::Configuration;
use IO::File;
use IO::Socket;
-use strict;
+use HTML::Entities;
+use Getopt::Long;
#globals
use vars qw (%perlvar %simplestatus $errors $warnings $notices $totalcount);
@@ -66,45 +68,52 @@ sub log {
sub errout {
my $fh=shift;
&log($fh,(<
+ Rotating error logs ... ");
+ &log($fh," Seems like it started ... ");
+ &log($fh," Seems like that did not work! ');
+ printf("%-15s ",$daemon);
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|");
while (my $line=
+
ENDERROUT
}
sub start_daemon {
- my ($fh,$daemon,$pidfile) = @_;
+ my ($fh,$daemon,$pidfile,$args) = @_;
my $progname=$daemon;
- if ($daemon eq 'lonc' && $ARGV[0] eq 'new') {
+ if ($daemon eq 'lonc' && $args eq 'new') {
$progname='loncnew';
print "new ";
}
- system("$perlvar{'lonDaemons'}/$progname 2>>$perlvar{'lonDaemons'}/logs/${daemon}_errors");
- sleep 2;
+ my $error_fname="$perlvar{'lonDaemons'}/logs/${daemon}_errors";
+ my $size=(stat($error_fname))[7];
+ if ($size>40000) {
+ &log($fh,"
Notices $notices Warnings $warnings
- Errors $errors '.$daemon.'
Log
');
- printf("%-10s ",$daemon);
+ &log($fh,'
");
+ &log($fh,"'.$daemon.'
Log
"); + &log($fh,"
Give it one more try ...
"); print " "; - if (&start_daemon($fh,$daemon,$pidfile)) { + if (&start_daemon($fh,$daemon,$pidfile,$args)) { &log($fh,""); + &log($fh,"
Unable to start $daemon
"); } } @@ -181,7 +197,7 @@ sub checkon_daemon { if ($line=~/CRITICAL/) { $notices++; } }; close (DFH); - &log($fh,""); + &log($fh,""); } } @@ -193,7 +209,7 @@ sub checkon_daemon { $blksize,$blocks)=stat($fname); if ($size>$maxsize) { - &log($fh,"Rotating logs ..."); + &log($fh,"
Rotating logs ...
"); rename("$fname.2","$fname.3"); rename("$fname.1","$fname.2"); rename("$fname","$fname.1"); @@ -205,7 +221,7 @@ sub checkon_daemon { # --------------------------------------------------------------------- Machine sub log_machine_info { my ($fh)=@_; - &log($fh,'"); my $psproc=0; - open (PSH,"ps -aux --cols 140 |"); + open (PSH,"ps aux --cols 140 |"); while (my $line=) { - &log($fh,"$line"); + &log($fh,&encode_entities($line,'<>&"')); $psproc++; } close (PSH); @@ -261,6 +277,16 @@ sub log_machine_info { if ($psproc>200) { $notices++; } if ($psproc>250) { $notices++; } + &log($fh," distprobe
"); + &log($fh,""); + open(DSH,"$perlvar{'lonDaemons'}/distprobe |"); + while (my $line="); + &errout($fh); } @@ -278,35 +304,36 @@ sub start_logging {) { + &log($fh,&encode_entities($line,'<>&"')); + $psproc++; + } + close(DSH); + &log($fh," LON Status Report $perlvar{'lonHostID'} - +LON Status Report $perlvar{'lonHostID'}
$date ($now)
-
-- Configuration -
- Machine Information -
- Temporary Files -
- Session Tokens -
- httpd -
- lonsql -
- lond -
- lonc -
- lonhttpd -
- lonnet -
- Connections -
- Delayed Messages -
- Error Coindex.html.unt +
- Configuration
+- Machine Information
+- Temporary Files
+- Session Tokens
+- httpd
+- lonsql
+- lond
+- lonc
+- lonhttpd
+- lonnet
+- Connections
+- Delayed Messages
+- Error Count
- +
+Configuration
PerlVars
-