0

I need yum cli command that can verifyed the helthcheck of all repo in my linux machine

I have try the yum repo but exit code still 0 ( IN SPITE WE HAVE ERROR )

yum repolist


https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-7Server-x86_64/repodata/repomd.xml: [Errno 14] curl#6 - "Could not resolve host: ddownload.postgresql.org; Name or service not known"
Trying other mirror.
insr/primary_db                                                                                                                                           |  23 kB  00:00:00
pkg/primary_db                                                                                                                                           |  29 kB  00:00:00
local/primary_db                                                                                                                                                      | 3.6 MB  00:00:00

# echo $?
0
  • not answer on my question , I need cli to verify the repo ( like health check ) , we can do yum repolist all | grep -i errno , but this way not covered all problems – yael Mar 4 '18 at 13:18
  • 1
    Then just use yum repolist -v or yum repoinfo. – Thomas Mar 4 '18 at 13:33
  • ok , but do you have solution to my previous question - unix.stackexchange.com/questions/428052/… – yael Mar 4 '18 at 13:44
1

To make yum repolist exit with a non-zero exit code on errors, you have to use verbose mode and use either

yum repolist -v 

or

yum repoinfo

From the man page of yum.

...One last special feature of repolist, is that if you are in non-verbose mode then yum will ignore any repo errors and output the information it can get...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.