Last active
August 29, 2015 14:11
-
-
Save rwcitek/21b1229e21ae795ddfca to your computer and use it in GitHub Desktop.
Generates a list of RPM packages for listening services that may require a restart with an upgrade.
This file contains 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/bash | |
# Generates a list of RPM packages for listening services that may result in services being restarted during a upgrade. | |
# These probably should not be upgraded automatically in a production environment. | |
netstat -plntu | | |
grep -o '[0-9]*/' | | |
tr -d / | | |
sort -u | | |
xargs -r -i stat -c "%N" /proc/{}/exe | | |
tr -d "\`'" | | |
cut -d" " -f3 | | |
xargs -r rpm -q --qf '%{NAME}\n' -f | | |
grep -v 'not owned' | | |
sort | | |
uniq | |
# To view the start times (and other info) of listening processes: | |
netstat -plntu | | |
grep -o '[0-9]*/' | | |
tr -d / | | |
xargs -r ps u -p | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment