詳細検索

remotediff

Avatar
by yuos
1 min read

remotediff
Translated from 日本語 • View original

Memo when diffing /etc/hosts between environments

After creating a large number of servers on Cloud, when checking conf comparisons, etc.

・Local-to-other (compared to /etc/hosts.backup)

$ diff /etc/hosts /etc/hosts.backup

・Local <->remote (xxx-web01)

$ diff /etc/hosts <(ssh xxx-web01 cat /etc/hosts)

 

・リモート(xxx-web01) <-> remote (xxx-web02)

$ diff <(ssh xxx-web01 cat /etc/hosts) <(ssh xxx-web02 cat /etc/hosts)

 

・ローカル<->multiple servers remotely (xxx-web01~10)

$ for SRV in xxx-web0{1..9} xxx-web10
> do
> echo ${SRV}
> diff /etc/hosts <(ssh ${srv}="" cat="" tc/hosts)=""> done

*: It is very easy to be able to SSH log in with a public key.

*: From CentOS6.x, you can write 'for SRV in xxx-web{01..10}'</(ssh></-></-></-> together.

Related Articles