--- loncom/loncron 2001/09/04 17:58:44 1.23 +++ loncom/loncron 2002/05/17 16:19:24 1.27 @@ -13,16 +13,18 @@ # 12/23 Gerd Kortemeyer # 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 +# YEAR=2002 +# 5/11/2002 Scott Harrison + +$|=1; + +use lib '/home/httpd/lib/perl/'; +use LONCAPA::Configuration; use IO::File; use IO::Socket; -my $qflag=0; -if (@ARGV) { - my $arg=shift @ARGV; - $qflag=1 if $arg eq 'quick'; -} - # -------------------------------------------------- Non-critical communication sub reply { my ($cmd,$server)=@_; @@ -53,19 +55,13 @@ ENDERROUT # ================================================================ Main Program -# ------------------------------------------------------------ Read access.conf -{ - my $config=IO::File->new("/etc/httpd/conf/access.conf"); - - while (my $configline=<$config>) { - if ($configline =~ /PerlSetVar/) { - my ($dummy,$varname,$varvalue)=split(/\s+/,$configline); - $perlvar{$varname}=$varvalue; - } - } - delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed - delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed -} +# --------------------------------- Read loncapa_apache.conf and loncapa.conf +my $perlvarref=LONCAPA::Configuration::read_conf('loncapa_apache.conf', + 'loncapa.conf'); +my %perlvar=%{$perlvarref}; +undef $perlvarref; +delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed +delete $perlvar{'lonSqlAccess'}; # remove since sensitive and not needed # --------------------------------------- Make sure that LON-CAPA is configured # I only test for one thing here (lonHostID). This is just a safeguard. @@ -210,7 +206,8 @@ while ($line=) { $usage=$parts[4]; $usage=~s/\W//g; if ($usage>90) { - $warnings++; + $warnings++; + $notices++; } elsif ($usage>80) { $warnings++; } elsif ($usage>60) { @@ -220,6 +217,23 @@ while ($line=) { } close (DFH); print $fh ""; + + +print $fh "

ps

"; +print $fh "
";
+$psproc=0;
+
+open (PSH,"ps -aux|");
+while ($line=) { 
+   print $fh "$line"; 
+   $psproc++;
+}
+close (PSH);
+print $fh "
"; + +if ($psproc>200) { $notices++; } +if ($psproc>250) { $notices++; } + &errout($fh); # --------------------------------------------------------------- clean out tmp @@ -332,13 +346,13 @@ if ($perlvar{'lonRole'} eq "library") { print $fh "

lonsql not running, trying to start

"; system( "$perlvar{'lonDaemons'}/lonsql 2>>$perlvar{'lonDaemons'}/logs/lonsql_errors"); - sleep 120 unless $qflag; + sleep 10; if (-e $lonsqlfile) { print $fh "Seems like it started ...

"; my $lfh=IO::File->new("$lonsqlfile"); my $lonsqlpid=<$lfh>; chomp($lonsqlpid); - sleep 30 unless $qflag; + sleep 30; if (kill 0 => $lonsqlpid) { print $fh "

lonsql at pid $lonsqlpid responding

"; } else { @@ -347,7 +361,7 @@ if ($perlvar{'lonRole'} eq "library") { print $fh "Give it one more try ...

"; system( "$perlvar{'lonDaemons'}/lonsql 2>>$perlvar{'lonDaemons'}/logs/lonsql_errors"); - sleep 120 unless $qflag; + sleep 10; } } else { print $fh "Seems like that did not work!

"; @@ -407,7 +421,8 @@ if (-e $londfile) { my $londpid=<$lfh>; chomp($londpid); if (kill 0 => $londpid) { - print $fh "

lond at pid $londpid responding

"; + print $fh "

lond at pid $londpid responding, sending USR1

"; + kill USR1 => $londpid; $restartflag=0; } else { $errors++; @@ -427,13 +442,13 @@ if ($restartflag==1) { print $fh "

lond not running, trying to start

"; system( "$perlvar{'lonDaemons'}/lond 2>>$perlvar{'lonDaemons'}/logs/lond_errors"); - sleep 120 unless $qflag; + sleep 10; if (-e $londfile) { print $fh "Seems like it started ...

"; my $lfh=IO::File->new("$londfile"); my $londpid=<$lfh>; chomp($londpid); - sleep 30 unless $qflag; + sleep 30; if (kill 0 => $londpid) { print $fh "

lond at pid $londpid responding

"; } else { @@ -442,7 +457,7 @@ if ($restartflag==1) { print $fh "Give it one more try ...

"; system( "$perlvar{'lonDaemons'}/lond 2>>$perlvar{'lonDaemons'}/logs/lond_errors"); - sleep 120 unless $qflag; + sleep 10; } } else { print $fh "Seems like that did not work!

"; @@ -523,13 +538,13 @@ if ($restartflag==1) { print $fh "

lonc not running, trying to start

"; system( "$perlvar{'lonDaemons'}/lonc 2>>$perlvar{'lonDaemons'}/logs/lonc_errors"); - sleep 120 unless $qflag; + sleep 10; if (-e $loncfile) { print $fh "Seems like it started ...

"; my $lfh=IO::File->new("$loncfile"); my $loncpid=<$lfh>; chomp($loncpid); - sleep 30 unless $qflag; + sleep 30; if (kill 0 => $loncpid) { print $fh "

lonc at pid $loncpid responding

"; } else { @@ -538,7 +553,7 @@ if ($restartflag==1) { print $fh "Give it one more try ...

"; system( "$perlvar{'lonDaemons'}/lonc 2>>$perlvar{'lonDaemons'}/logs/lonc_errors"); - sleep 120 unless $qflag; + sleep 10; } } else { print $fh "Seems like that did not work!

"; @@ -681,8 +696,7 @@ if ($totalcount>200) { $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; $subj="LON: $perlvar{'lonHostID'} E:$errors W:$warnings N:$notices"; system( - "metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html") - unless $qflag; + "metasend -b -t $emailto -s '$subj' -f $statusdir/index.html -m text/html"); } 1;