Diff for /loncom/loncron between versions 1.125 and 1.129

version 1.125, 2021/01/30 21:26:04 version 1.129, 2024/06/22 14:29:36
Line 42  use IO::File; Line 42  use IO::File;
 use IO::Socket;  use IO::Socket;
 use HTML::Entities;  use HTML::Entities;
 use Getopt::Long;  use Getopt::Long;
 use GDBM_File;  use GDBM_File qw(GDBM_READER);
 use Storable qw(thaw);  use Storable qw(thaw);
 use File::ReadBackwards;  use File::ReadBackwards;
 use File::Copy;  use File::Copy;
Line 231  sub log_machine_info { Line 231  sub log_machine_info {
     &log($fh,'<hr /><a name="machine" /><h2>Machine Information</h2>');      &log($fh,'<hr /><a name="machine" /><h2>Machine Information</h2>');
     &log($fh,"<h3>loadavg</h3>");      &log($fh,"<h3>loadavg</h3>");
   
       my $cpucount;
       if (open(PIPE,"lscpu |grep '^CPU(s)' 2>&1 |")) {
           my $info = <PIPE>;
           chomp($info);
           ($cpucount) = ($info =~ /^\QCPU(s):\E\s+(\d+)$/);
           close(PIPE);
       }
       if (!$cpucount) {
           $cpucount = 1;
       }
       my %loadtarget = (
                           error => 4.0*$cpucount,
                           warn  => 2.0*$cpucount,
                           note  => 1.0*$cpucount,
                        );
     open (LOADAVGH,"/proc/loadavg");      open (LOADAVGH,"/proc/loadavg");
     my $loadavg=<LOADAVGH>;      my $loadavg=<LOADAVGH>;
     close (LOADAVGH);      close (LOADAVGH);
Line 238  sub log_machine_info { Line 253  sub log_machine_info {
     &log($fh,"<tt>$loadavg</tt>");      &log($fh,"<tt>$loadavg</tt>");
   
     my @parts=split(/\s+/,$loadavg);      my @parts=split(/\s+/,$loadavg);
     if ($parts[1]>4.0) {      if ($parts[1]>$loadtarget{'error'}) {
  $errors++;   $errors++;
     } elsif ($parts[1]>2.0) {      } elsif ($parts[1]>$loadtarget{'warn'}) {
  $warnings++;   $warnings++;
     } elsif ($parts[1]>1.0) {      } elsif ($parts[1]>$loadtarget{'note'}) {
  $notices++;   $notices++;
     }      }
   
Line 1580  sub main () { Line 1595  sub main () {
     my $wwwid=getpwnam('www');      my $wwwid=getpwnam('www');
     if ($wwwid!=$<) {      if ($wwwid!=$<) {
  print("User ID mismatch. This program must be run as user 'www'.\n");   print("User ID mismatch. This program must be run as user 'www'.\n");
  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.' |".
                " mail -s '$subj' $emailto > /dev/null");                 " mail -s '$subj' $emailto > /dev/null");

Removed from v.1.125  
changed lines
  Added in v.1.129


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>