version 1.13, 2002/12/18 14:37:45
|
version 1.17, 2003/07/30 16:49:27
|
Line 62 Scott Harrison, sharrison@users.sourcefo
|
Line 62 Scott Harrison, sharrison@users.sourcefo
|
|
|
=cut |
=cut |
|
|
# ' stupid emacs |
|
# ================================================== READ IN COMMAND ARGUMENTS. |
# ================================================== READ IN COMMAND ARGUMENTS. |
|
|
# ---------------------------------------------------- Process download option. |
# ---------------------------------------------------- Process download option. |
Line 112 my @serverpaths_to_try =
|
Line 111 my @serverpaths_to_try =
|
); |
); |
|
|
# -------------------------------------------- Use check-rpms command this way. |
# -------------------------------------------- Use check-rpms command this way. |
my $checkcommand = 'check-rpms '.$download.' --rpmuser www -ftp'; |
my $checkcommand = 'check-rpms -nk '.$download.' --rpmuser www -ftp'; |
|
|
my $FTPSERVER; # ------------------------- the server portion of the serverpath |
my $FTPSERVER; # ------------------------- the server portion of the serverpath |
my $FTPUPDATES; # ----------------------------- the actual update root location |
my $FTPUPDATES; # ----------------------------- the actual update root location |
Line 120 my @rpms; # ----------------------------
|
Line 119 my @rpms; # ----------------------------
|
my $goodoutput; # ------------------------------------ good stuff was returned! |
my $goodoutput; # ------------------------------------ good stuff was returned! |
my $reallygoodoutput; # ------------------------------- you are 100% up-to-date |
my $reallygoodoutput; # ------------------------------- you are 100% up-to-date |
|
|
|
my $simplestatus='time='.time.'&'; |
|
|
# ===================================================== Control flow of output. |
# ===================================================== Control flow of output. |
my $out = \*STDOUT; # Default: go to standard output (directly to terminal). |
my $out = \*STDOUT; # Default: go to standard output (directly to terminal). |
|
|
Line 265 END
|
Line 266 END
|
if (!$goodoutput) # If never received any useable output, assume "no server". |
if (!$goodoutput) # If never received any useable output, assume "no server". |
{ |
{ |
print($out '**** ERROR **** Cannot find a working ftp server.'."\n"); |
print($out '**** ERROR **** Cannot find a working ftp server.'."\n"); |
|
$simplestatus.='status=fail'; |
clean_exit($mode,$out,0); |
clean_exit($mode,$out,0); |
} |
} |
elsif ($reallygoodoutput) # Everything is peachy keen and up-to-date already. |
elsif ($reallygoodoutput) # Everything is peachy keen and up-to-date already. |
{ |
{ |
print($out $reallygoodoutput); |
print($out $reallygoodoutput); |
|
$simplestatus.='status=okay'; |
} |
} |
else # There are RPMs that need to be updated; show list to user. |
else # There are RPMs that need to be updated; show list to user. |
{ |
{ |
Line 280 the list below. THIS IS IMPORTANT FOR S
|
Line 283 the list below. THIS IS IMPORTANT FOR S
|
|
|
END |
END |
print($out $goodoutput); # Output the RPM list. |
print($out $goodoutput); # Output the RPM list. |
|
$simplestatus.='status=okay&rpmcount='.$rpmcount; |
if ($mode eq 'interactive') |
if ($mode eq 'interactive') |
{ |
{ |
print($out <<END); |
print($out <<END); |
Line 318 clean_exit($mode,$out,0);
|
Line 322 clean_exit($mode,$out,0);
|
sub clean_exit |
sub clean_exit |
{ |
{ |
my ($mode,$out,$code)=@_; |
my ($mode,$out,$code)=@_; |
|
# |
|
# Store simple status |
|
# |
|
open(SMP,'>/home/httpd/html/lon-status/checkrpms.txt'); |
|
print SMP $simplestatus."\n"; |
|
close(SMP); |
|
# |
|
# Mail |
|
# |
if ($mode eq 'cronmail') # If cronmail mode, then mail LON-CAPA sys admin. |
if ($mode eq 'cronmail') # If cronmail mode, then mail LON-CAPA sys admin. |
{ |
{ |
close(FOUT); |
close(FOUT); |
Line 331 sub clean_exit
|
Line 343 sub clean_exit
|
delete $perlvar{'lonSqlAccess'}; # remove since sensitive |
delete $perlvar{'lonSqlAccess'}; # remove since sensitive |
|
|
# Set metadata for the e-mail. |
# Set metadata for the e-mail. |
my $emailto = "$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}"; |
my $emailto = "$perlvar{'lonAdmEMail'}"; |
|
|
my $subj=$perlvar{'lonHostID'}.', RPMS to upgrade'; |
my $subj=$perlvar{'lonHostID'}.', RPMS to upgrade'; |
|
|
Line 346 sub clean_exit
|
Line 358 sub clean_exit
|
} |
} |
|
|
# Send the e-mail. |
# Send the e-mail. |
if (!$reallygoodoutput) |
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( |
system( |
'metasend -b -t '.$emailto.' -s '. |
'metasend -b -t '.$emailto.' -s '. |