--- loncom/loncron 2004/05/11 19:15:03 1.47
+++ loncom/loncron 2004/06/09 13:30:41 1.53
@@ -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.53 2004/06/09 13:30:41 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,25 +68,33 @@ 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("%-10s ",$daemon);
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|");
@@ -115,7 +125,7 @@ sub checkon_daemon {
};
close (DFH);
}
- &log($fh,"
+
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");
+ 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
');
+ &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 +191,7 @@ sub checkon_daemon { if ($line=~/CRITICAL/) { $notices++; } }; close (DFH); - &log($fh,""); + &log($fh,""); } } @@ -193,7 +203,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 +215,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); @@ -278,35 +288,36 @@ sub start_logging { 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
-