Compare RPMs between two systems

From Bitbull Wiki
Revision as of 15:33, 15 September 2017 by Chris (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

want to build a clone?
or to migrate an application?
this is a way to compare RPMs of two systems


#!/bin/bash
IP_MASTER=$1

echo ...oooOOO following RPMs are not installed on on localhost   OOOooo...
for RPM_MASTER in $(ssh $IP_MASTER 'rpm -qa --qf %{NAME}\ ')
do
   rpm -q $RPM_MASTER >/dev/null 2>&1
   if [ $? -ne 0 ]
   then
      RPM_ALL="$RPM_ALL $RPM_MASTER"
   fi
done
echo ""
echo install missing RPMs:
echo yum install $RPM_ALL
echo ""

echo ...oooOOO following SERVICES are not activated on on localhost   OOOooo...
SRV_LOCAL="$(/sbin/chkconfig --list | grep 3:on | awk '{print $1}' | xargs echo | tr ' ' '|')"
echo ""
echo "activate services:"
for SRV in $(ssh $IP_MASTER '/sbin/chkconfig --list' | grep 3:on | egrep -v "$SRV_LOCAL" | awk '{print $1}' )
do
   echo chkconfig $SRV on
done