--- loncom/build/Attic/CHECKRPMS.default 2002/11/04 01:51:49 1.9 +++ loncom/build/Attic/CHECKRPMS.default 2003/03/10 17:34:52 1.15 @@ -72,7 +72,7 @@ if ($argument eq '--download' or $argume { if ($< != 0) # Download mode requires 'root'. { - print($out + print( '**** ERROR **** Download mode needs to be run as root'."\n"); exit(0); # Exit. } @@ -195,7 +195,7 @@ SERVERLOOP: foreach my $serverpath (@ser $FTPSERVER_noauth=~s/^.*?\@//; print($out "Trying $FTPSERVER_noauth...\n"); # Notify of attempts with ip name. - `ping -c 1 $FTPSERVER_noauth 2>/dev/null`; # Ping ftp server (you there?). + `ping -c 1 -w 10 $FTPSERVER_noauth 2>/dev/null`;#Ping ftp server (u there?) if ($?==0) # If the ftp server can be pinged. { print($out "$FTPSERVER found...\n"); # Tell user ftp server is found. @@ -321,6 +321,7 @@ sub clean_exit if ($mode eq 'cronmail') # If cronmail mode, then mail LON-CAPA sys admin. { close(FOUT); + # Read in configuration to get e-mail addresses. my $perlvarref = read_conf('loncapa.conf'); my %perlvar = %{$perlvarref}; @@ -329,12 +330,32 @@ sub clean_exit delete $perlvar{'lonSqlAccess'}; # remove since sensitive # Set metadata for the e-mail. - my $emailto = "$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; -# my $emailto = "sharrison\@users.sourceforge.net"; - my $subj="LON: $perlvar{'lonHostID'}, RPMS to upgrade"; - system( - 'metasend -b -t '.$emailto.' -s '. - "'$subj' -f /tmp/CHECKRPMS.$$ -m text/plain"); + my $emailto = "$perlvar{'lonAdmEMail'}"; + + my $subj=$perlvar{'lonHostID'}.', RPMS to upgrade'; + + # Make the e-mail's subject header to describe whether up-to-date. + if ($reallygoodoutput) + { + $subj = 'happy_lon: '.$subj; # Machine is up-to-date. + } + else + { + $subj = 'ALERT_lon: '.$subj; # There are out-of-date RPMs. + } + + # Send the e-mail. + my $date = `date +"\%e"`; # Always send a day after the "Ides" or after + # the beginning of a month. (In other words, + # send an e-mail every two weeks regardless.) + if (!$reallygoodoutput or + $date == 2 or + $date == 16) + { + system( + 'metasend -b -t '.$emailto.' -s '. + "'$subj' -f /tmp/CHECKRPMS.$$ -m text/plain"); + } } print($out <