Created
June 4, 2012 21:33
-
-
Save jblaine/2870955 to your computer and use it in GitHub Desktop.
Safer yum
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # | |
| # If yum experiences a corrupt database it very frequently | |
| # just hangs. This most commonly seen as a hung 'rpmq' | |
| # command (a child of yum). When performing automated yum | |
| # commands, this is bad news, as they can just start piling up. | |
| # | |
| # Try to determine if there are any corrupt RPM database files, try | |
| # to rebuild them if so, THEN run yum. | |
| # | |
| # jblaine 6/4/2012 | |
| if [ -x /usr/lib/rpm/rpmdb_verify ]; then | |
| /usr/lib/rpm/rpmdb_verify /var/lib/rpm/[A-Z]* > /dev/null 2>&1 | |
| if [ $? -ne 0 ]; then | |
| rpm --rebuilddb | |
| fi | |
| fi | |
| /usr/bin/yum "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment