关于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

聊聊天,共同进步

【腾讯云】轻量 2核2G4M,首年65元

阿里云限时活动-云数据库 RDS MySQL  1核2G配置 1.88/月 速抢

本文由乐趣区整理发布,转载请注明出处,谢谢。

您可能还喜欢...

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据