Skip to content

Instantly share code, notes, and snippets.

@traylenator
Created February 19, 2013 15:08
Show Gist options
  • Save traylenator/4986691 to your computer and use it in GitHub Desktop.
Save traylenator/4986691 to your computer and use it in GitHub Desktop.
Script to compare rpm leaves on two machines
#!/usr/bin/ruby
ref = 'lxplus6.cern.ch'
target = 'i130215090503.cern.ch'
refrpms = %x"ssh root@#{ref} \"package-cleanup -q --all --leaves | xargs -i rpm --queryformat '%{name}.%{arch}\n' -q {}\" ".split
targetrpms = %x"ssh root@#{target} \"package-cleanup -q --all --leaves | xargs -i rpm --queryformat '%{name}.%{arch}\n' -q {}\" ".split
puts "### Missing leaves on target machine"
puts refrpms - targetrpms
puts "### Additional leaves target machine"
puts targetrpms - refrpms
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment