#!/bin/bash


addHost() {
    head -n 10 /etc/hosts > 1.txt

    cat 1.txt > /etc/hosts
    cat /etc/hosts
    rm 1.txt
    cat >> /etc/hosts<<EOF
146.56.147.12 arm-s-1 s0
10.10.0.10 arm-s-1 s0
10.0.0.91 arm-s-1 s0

146.56.159.175 arm-s-2 s5
10.10.0.20 arm-s-2 s5
10.0.0.173 arm-s-2 s5

140.238.8.73 seoul-1 s1
10.10.0.11 seoul-1 s1
10.0.0.3 seoul-1 s1

140.238.30.110 seoul-2 s2
10.10.0.12 seoul-2 s2
10.0.0.14 seoul-2 s2

140.238.29.102 seoul-3 s3
10.10.0.13 seoul-3 s3
10.0.0.2 seoul-3 s3

140.238.14.103 seoul-4 s4
10.10.0.14 seoul-4 s4
10.0.0.3 seoul-4 s4

150.230.198.103 tokyo-0 t0
10.10.0.20 arm-s-1 t0

140.238.63.37 tokyo-1 t1
10.10.0.21 tokyo-1 t1

140.238.52.228 tokyo-2 t2
10.10.0.22 tokyo-2 t2

42.192.52.227 tc-sh
10.10.0.71 tc-sh

43.128.39.232 tc-hk
10.10.0.79 tc-hk

114.117.165.222 tc-cd
10.10.0.72 tc-cd
EOF
  cat /etc/hosts
}

clearHosts(){

}


shutdownIPtables(){
  # oracle 主机可以使用下面的额命令进行清除
  snap info oracle-cloud-agent
  snap stop oracle-cloud-agent
  snap remove oracle-cloud-agent

  systemctl status snapd.service

  for i in $(ls /lib/systemd/system/ | grep snapd | awk '{print$1}') ; do
    echo $i
    systemctl stop $i
    systemctl disable $i
  done

  rm -rf /root/snap

  systemctl stop ufw
  systemctl disable ufw
  #停止firewall
  systemctl stop firewalld.service
  #禁止firewall开机启动

  systemctl disable firewalld.service
  #关闭iptables
  service iptables stop
  #去掉iptables开机启动
  chkconfig iptables off

  systemctl stop ip6tables.service
  systemctl disable ip6tables.service

  crontab -e
  @reboot "iptables -F"
}