version 1.107, 2018/08/07 17:12:09
|
version 1.111, 2018/10/29 02:46:41
|
Line 113 sub checkon_daemon {
|
Line 113 sub checkon_daemon {
|
my $result; |
my $result; |
&log($fh,'<hr /><a name="'.$daemon.'" /><h2>'.$daemon.'</h2><h3>Log</h3><p style="white-space: pre;"><tt>'); |
&log($fh,'<hr /><a name="'.$daemon.'" /><h2>'.$daemon.'</h2><h3>Log</h3><p style="white-space: pre;"><tt>'); |
printf("%-15s ",$daemon); |
printf("%-15s ",$daemon); |
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
if ($fh) { |
open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|"); |
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
while (my $line=<DFH>) { |
if (open(DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|")) { |
&log($fh,"$line"); |
while (my $line=<DFH>) { |
if ($line=~/INFO/) { $notices++; } |
&log($fh,"$line"); |
if ($line=~/WARNING/) { $notices++; } |
if ($line=~/INFO/) { $notices++; } |
if ($line=~/CRITICAL/) { $warnings++; } |
if ($line=~/WARNING/) { $notices++; } |
}; |
if ($line=~/CRITICAL/) { $warnings++; } |
close (DFH); |
} |
|
close (DFH); |
|
} |
|
} |
|
&log($fh,"</tt></p>"); |
} |
} |
&log($fh,"</tt></p>"); |
|
|
|
my $pidfile="$perlvar{'lonDaemons'}/logs/$daemon.pid"; |
my $pidfile="$perlvar{'lonDaemons'}/logs/$daemon.pid"; |
|
|
Line 169 sub checkon_daemon {
|
Line 172 sub checkon_daemon {
|
&clean_lonc_childpids(); |
&clean_lonc_childpids(); |
} |
} |
&log($fh,"<h3>$daemon not running, trying to start</h3>"); |
&log($fh,"<h3>$daemon not running, trying to start</h3>"); |
|
|
if (&start_daemon($fh,$daemon,$pidfile,$args)) { |
if (&start_daemon($fh,$daemon,$pidfile,$args)) { |
&log($fh,"<h3>$daemon at pid $daemonpid responding</h3>"); |
&log($fh,"<h3>$daemon at pid $daemonpid responding</h3>"); |
$simplestatus{$daemon}='restarted'; |
$simplestatus{$daemon}='restarted'; |
Line 194 sub checkon_daemon {
|
Line 197 sub checkon_daemon {
|
&log($fh,"<p>Unable to start $daemon</p>"); |
&log($fh,"<p>Unable to start $daemon</p>"); |
} |
} |
} |
} |
|
if ($fh) { |
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ |
&log($fh,"<p><pre>"); |
&log($fh,"<p><pre>"); |
open (DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|"); |
if (open(DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|")) { |
while (my $line=<DFH>) { |
while (my $line=<DFH>) { |
&log($fh,"$line"); |
&log($fh,"$line"); |
if ($line=~/WARNING/) { $notices++; } |
if ($line=~/WARNING/) { $notices++; } |
if ($line=~/CRITICAL/) { $notices++; } |
if ($line=~/CRITICAL/) { $notices++; } |
}; |
} |
close (DFH); |
close (DFH); |
&log($fh,"</pre></p>"); |
} |
|
&log($fh,"</pre></p>"); |
|
} |
} |
} |
} |
} |
|
|
Line 1028 sub update_revocation_list {
|
Line 1033 sub update_revocation_list {
|
} |
} |
|
|
sub reset_nosslverify_pids { |
sub reset_nosslverify_pids { |
my (%sslrem) = @_; |
my ($fh,%sslrem) = @_; |
&checkon_daemon($fh,'lond',40000,'USR2'); |
&checkon_daemon($fh,'lond',40000,'USR2'); |
my $loncpidfile="$perlvar{'lonDaemons'}/logs/lonc.pid"; |
my $loncpidfile="$perlvar{'lonDaemons'}/logs/lonc.pid"; |
my $loncppid; |
my $loncppid; |
Line 1057 sub reset_nosslverify_pids {
|
Line 1062 sub reset_nosslverify_pids {
|
if ($sslrem{$host}) { |
if ($sslrem{$host}) { |
if (ref($pids_by_host{$host}) eq 'HASH') { |
if (ref($pids_by_host{$host}) eq 'HASH') { |
if (ref($pids_by_host{$host}{'insecure'}) eq 'HASH') { |
if (ref($pids_by_host{$host}{'insecure'}) eq 'HASH') { |
if (keys($pids_by_host{$host}{'insecure'})) { |
if (keys(%{$pids_by_host{$host}{'insecure'}})) { |
foreach my $pid (keys($pids_by_host{$host}{'insecure'})) { |
foreach my $pid (keys(%{$pids_by_host{$host}{'insecure'}})) { |
if (open(PIPE,"ps -o ppid= -p $pid |")) { |
if (open(PIPE,"ps -o ppid= -p $pid |")) { |
my $ppid = <PIPE>; |
my $ppid = <PIPE>; |
chomp($ppid); |
chomp($ppid); |
Line 1172 sub main () {
|
Line 1177 sub main () {
|
$hostname=~s/[^\w\.]//g; # make sure is safe to pass through shell |
$hostname=~s/[^\w\.]//g; # make sure is safe to pass through shell |
my $subj="LON: Unconfigured machine $hostname"; |
my $subj="LON: Unconfigured machine $hostname"; |
system("echo 'Unconfigured machine $hostname.' |\ |
system("echo 'Unconfigured machine $hostname.' |\ |
mailto $emailto -s '$subj' > /dev/null"); |
mail -s '$subj' $emailto > /dev/null"); |
exit 1; |
exit 1; |
} |
} |
|
|
Line 1183 sub main () {
|
Line 1188 sub main () {
|
my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
my $subj="LON: $perlvar{'lonHostID'} User ID mismatch"; |
my $subj="LON: $perlvar{'lonHostID'} User ID mismatch"; |
system("echo 'User ID mismatch. loncron must be run as user www.' |\ |
system("echo 'User ID mismatch. loncron must be run as user www.' |\ |
mailto $emailto -s '$subj' > /dev/null"); |
mail -s '$subj' $emailto > /dev/null"); |
exit 1; |
exit 1; |
} |
} |
|
|
Line 1274 sub main () {
|
Line 1279 sub main () {
|
&write_serverhomeIDs(); |
&write_serverhomeIDs(); |
&write_checksums(); |
&write_checksums(); |
my %sslrem = &clean_nosslverify($fh); |
my %sslrem = &clean_nosslverify($fh); |
&finish_logging($fh); |
|
my %conchgs = &write_connection_config(); |
my %conchgs = &write_connection_config(); |
my %hosttypechgs = &write_hosttypes(); |
my %hosttypechgs = &write_hosttypes(); |
my $hadcrlchg = &update_revocation_list(); |
my $hadcrlchg = &update_revocation_list(); |
if ((keys(%{$conchgs}) > 0) || (keys(%hosttypechgs) > 0) || |
if ((keys(%conchgs) > 0) || (keys(%hosttypechgs) > 0) || |
$hadcrlchg || (keys(%sslrem) > 0)) { |
$hadcrlchg || (keys(%sslrem) > 0)) { |
&checkon_daemon($fh,'lond',40000,'USR2'); |
&checkon_daemon($fh,'lond',40000,'USR2'); |
&reset_nosslverify_pids(%sslrem); |
&reset_nosslverify_pids($fh,%sslrem); |
} |
} |
|
&finish_logging($fh); |
if ($totalcount>200 && !$noemail) { &send_mail(); } |
if ($totalcount>200 && !$noemail) { &send_mail(); } |
} |
} |
} |
} |