sync_hosts_file.sh 312 B

123456789101112131415161718
  1. #!/usr/bin/env bash
  2. #
  3. # JimV-C
  4. #
  5. # Copyright (C) 2017 JimV <james.iter.cn@gmail.com>
  6. #
  7. # Author: James Iter <james.iter.cn@gmail.com>
  8. #
  9. # Sync the /etc/hosts file.
  10. #
  11. DHOSTS=`egrep -v '^$|localhost|jimvc' /etc/hosts | awk '{ print $1; }'`
  12. for dhost in ${DHOSTS}
  13. do
  14. scp /etc/hosts ${dhost}:/etc/hosts
  15. done