yuos

yuos

  • remotediff

    各環境間での /etc/hosts をdiffする場合のmemo

    Cloud上でサーバを大量に作成したあと、confの比較チェックするときなどに。

     

    ・ローカル同士(/etc/hosts.backupと比較)

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

     

    ・ローカル<->リモート(xxx-web01)

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

     

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

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

     

    ・ローカル<->リモートで復数サーバ(xxx-web01~10)

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

     

    ...