乐趣区

关于docker:重启所有compose服务

重启命令



/free_cicdfs0/restart_service.sh

脚本 内容


cat > /free_cicdfs0/restart_service.sh <<"EOF"
#!/bin/bash

node01_ip_list=('192.168.71.100/32')

node02_ip_list=(
  '192.168.71.101/32' 
  '192.168.71.105/32' 
)

float_ip_list=(${node01_ip_list[*]}
  ${node02_ip_list[*]}
)

node01_compose_paths=(
  '/free_cicdfs0/composes/gerrit'
  '/free_cicdfs0/composes/registry'
  '/free_cicdfs0/composes/gost'
  '/free_cicdfs0/composes/webssh'
  '/free_cicdfs0/composes/wuhan_owncloud'
  '/free_cicdfs0/composes/wuhan_home'
)

node02_compose_paths=(
  '/free_cicdfs0/composes/jenkins'
  '/free_cicdfs0/composes/esmod_owncloud'
)

compose_paths=(${node01_compose_paths[*]}
  ${node02_compose_paths[*]}
)


function free_all_ip(){for i in ${float_ip_list[*]} 
  do
   ip addr del ${i}  dev vlan71
  done
}



function down_compose(){
  cd $1
  docker-compose down
}

function start_compose(){
  cd $1
  docker-compose up -d
}

function down_compose_s(){for i in ${compose_paths[*]} 
  do
   down_compose ${i} &
  done
}

function start_compose_s(){for i in ${compose_paths[*]} 
  do
   start_compose ${i} &
  done
}

free_all_ip

down_compose_s 


# start service on right node

if [1 = $#]
then

else

fi


EOF

聊聊天,共同进步

退出移动版