Command to identify rpmdb open failed message

greavette

New Member
Joined
Sep 12, 2019
Messages
4
Reaction score
0
Credits
0
Hello,

We run CentOS and some Red Hat servers. Is there a one line command I can issue from the terminal to tell me if my yum database has become corrupted with the 'rpmdb open failed' message?

I know I can see this when I try to update a server. But I'd like to issue a one line command to return that this problem exists or doesn't exist.

Thank you.
 


Hello @arochester , thank you for this reply.

I'm looking to use this one line command from a script (chef eventually) to help me determine proactively before we patch that servers have this yum database issue.

Thank you.
 
Here is an example of what I'm trying to do. If someone can help me formulate this line properly to get what I need please:

Code:
sudo yum repolist | grep -qi 'Error: rpmdb open failed ' ; case "$?" in "0") echo "match" ;; "1") echo "no match" ;; *) echo "error" ;; esac

Would that give me what I'm looking for?

Thanks!
 

Members online


Top