[Yum] Yum scripts

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

 



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