Hi,
I have a file, sol_servers_global, which is list of all solaris global servers in my environment and another file,
solaris_non_global_zones_from_DB. I have a gateway server, from where all servers are contactable via ssh. I have collected name of zones running on these servers with below commands.
HTML Code:
for i in `cat sol_servers_global`; do sudo ssh $i zoneadm list | grep -v global >>/var/tmp/all_zones; done
My basic idea is to prepare a script, which should -->
1- Capture zones running on servers listed on sol_servers_global (May be I can run for loop listed above)
2- Compare both files and list out zones which are not in solaris_non_global_zones_from_DB, but present in /var/tmp/all_zones and redirect to /var/tmp/servers_not_in_db.
3- Compare both files and list out zones which are not in /var/tmp/all_zones, but present in solaris_non_global_zones_from_DB and redirect to /var/tmp/servers_not_exist.
I was trying to compare it with below commands. If you have any easy and better compare tool, please suggest that too.
HTML Code:
awk 'FNR==NR{a[$0];next} !($0 in a)' solaris_non_global_zones_from_DB /var/tmp/all_zones >>/var/tmp/servers_not_in_db
awk 'FNR==NR{a[$0];next} !($0 in a)' /var/tmp/all_zones solaris_non_global_zones_from_DB >>/var/tmp/servers_not_exist
I was doing it manually. It is very frequent so it takes long time to do it. If somebody can help me with script, it will be easy for me to do it fast.
Regards