shell

  1. print_help() {
  2. cat << EOF
  3. use regist_co.sh args1 args2
  4. args1 - The Hostname of the machine to be registered to the consul cluster , For example: co-mini-jupiter-x
  5. args2 - What's the type of IP , For example: 10.50.0.196
  6. args4 - Consul server ip address
  7. As follows:
  8. 兰亭美国: 10.50.0.2409
  9. 兰亭欧洲: 10.241.2.100
  10. Run as: ./regist_co.sh co-mini-jupiter-x 10.50.0.19x
  11. EOF
  12. }
  13. if [ "$#" != 2 ]; then
  14. print_help;
  15. exit 1;
  16. fi

python

  1. if len(sys.argv) < 3:
  2. print ('''Usage : python '''+sys.argv[0]+''' <hostname> <ip> {<node>|None}''')
  3. else:
  4. hostname = sys.argv[1]
  5. ip = sys.argv[2]
  6. if ip.split(".")[0] == '10' and ip.split(".")[1] == '50':