[Yum] Yum scripts

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Careful what you ask Seth for, he may try to write that in python for
you! ;)

-Jeff

On Thu, 2003-09-25 at 08:48, Bryan White wrote:
> Matthew.Quinney@xxxxxxxxxxxxxxxxxxxxx wrote:
> 
> > 
> > Seth,
> > 
> > Thanks, your debug worked and I got the correct error. I am trying to 
> > work out how to add this to a shellscript so that I can send back 
> > formatted errors to Nagios. Can you help me with my Perl code, I am a 
> > bit of a novice ? Here is my program....
> > 
> > #!/usr/bin/perl
> > #
> > 
> > open( YUMGET, "yum check-update; echo $? |");
> > $value = <YUMGET>;
> > 
> > close (YUMGET);
> > 
> > if($value =~ /100/) {
> >         print "YUM UPDATES AVAILABLE - $value\n";
> >         exit(2);
> > } else {
> >         print "YUM OKAY - NO UPDATES AVAILABLE - $value\n";
> >         exit(O);
> > }
> 
> Try this:
> #!/usr/bin/perl
> #
> 
> $value = system "yum check-update";
> 
> if($value == 100) {
>           print "YUM UPDATES AVAILABLE - $value\n";
>           exit(2);
> } else {
>           print "YUM OKAY - NO UPDATES AVAILABLE - $value\n";
>           exit(O);
> }
> 
> Bryan


[Index of Archives]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux