--- loncom/loncron 2018/10/25 02:48:56 1.109 +++ loncom/loncron 2018/10/29 02:46:41 1.111 @@ -2,7 +2,7 @@ # Housekeeping program, started by cron, loncontrol and loncron.pl # -# $Id: loncron,v 1.109 2018/10/25 02:48:56 raeburn Exp $ +# $Id: loncron,v 1.111 2018/10/29 02:46:41 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -113,17 +113,20 @@ sub checkon_daemon { my $result; &log($fh,'
');
printf("%-15s ",$daemon);
- if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){
- open (DFH,"tail -n25 $perlvar{'lonDaemons'}/logs/$daemon.log|");
- while (my $line=
Unable to start $daemon
"); } } - - if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ - &log($fh,""); - open (DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|"); - while (my $line="); + if ($fh) { + if (-e "$perlvar{'lonDaemons'}/logs/$daemon.log"){ + &log($fh,") { - &log($fh,"$line"); - if ($line=~/WARNING/) { $notices++; } - if ($line=~/CRITICAL/) { $notices++; } - }; - close (DFH); - &log($fh,"
"); + if (open(DFH,"tail -n100 $perlvar{'lonDaemons'}/logs/$daemon.log|")) { + while (my $line="); + } } } @@ -1172,7 +1177,7 @@ sub main () { $hostname=~s/[^\w\.]//g; # make sure is safe to pass through shell my $subj="LON: Unconfigured machine $hostname"; system("echo 'Unconfigured machine $hostname.' |\ - mailto $emailto -s '$subj' > /dev/null"); + mail -s '$subj' $emailto > /dev/null"); exit 1; } @@ -1183,7 +1188,7 @@ sub main () { my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; my $subj="LON: $perlvar{'lonHostID'} User ID mismatch"; 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; }) { + &log($fh,"$line"); + if ($line=~/WARNING/) { $notices++; } + if ($line=~/CRITICAL/) { $notices++; } + } + close (DFH); + } + &log($fh,"