--- loncom/build/Attic/CHECKRPMS.suse 2005/04/13 18:56:46 1.1 +++ loncom/build/Attic/CHECKRPMS.suse 2005/07/29 21:14:03 1.2 @@ -2,7 +2,7 @@ # # The LearningOnline Network with CAPA # -# $Id: CHECKRPMS.suse,v 1.1 2005/04/13 18:56:46 albertel Exp $ +# $Id: CHECKRPMS.suse,v 1.2 2005/07/29 21:14:03 raeburn Exp $ # # Copyright Michigan State University Board of Trustees # @@ -79,22 +79,21 @@ ENDHEADER close(TMPFILE); # -# Execute yum command -my $command = $you.' -s -k -l en '.'>>'.$tmpfile; -system($command); - -my $returnvalue = $?>>8; - -# -# Determine status of yum run -if (100 == $returnvalue) { - $subj.= ' RPMS to upgrade'; - # Send email - system(qq{mail -s '$subj' $emailto < $tmpfile}); -} elsif (0 != $returnvalue) { +# Execute online_update command to check for updates +if (open (PIPE, "$you -d -k -l en 2>&1 |")) { + my $output=; + close(PIPE); + chomp $output; + unless ($output eq 'No updates available.') { + my $command = $you.' -s -k -l en |grep ^[^I] >>'.$tmpfile; + system($command); + + $subj.= ' RPMS to upgrade'; + # Send email + system(qq{mail -s '$subj' $emailto < $tmpfile}); + } +} else { # Send email $subj.= ' Error running RPM update script'; system(qq{mail -s '$subj' $emailto < $tmpfile}); -} else { - # you returned 0, so everything is up to date. }