In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Recently, you often need to start or stop docker manually in daily testing, so you decide to write a Shell script instead of manual operation. In addition, this script can also be called remotely through the Python script, as shown below:
At present, the script is to write Container ID in the script, of course, you can also pass parameters to the script to control, you can modify it.
Start docker
The details of the startup script are as follows:
#! / bin/bashcontainerIDs= "ad3e4d7fc407 a228730a915f ad3e4d7fc4099" statusLived= "live" statusdead= "Dead" notExistContainer= "None" retryCount=3function GetContainerStatus () {containerExist=$ (sudo docker ps-a | grep-I $1 | wc-l) if [${containerExist}-gt 0] then pid=$ (sudo docker stats-- format "{{.PIDs}"-- no-stream $1) if ["${pid}"! = "0"] then echo "${statusLived}" else echo "${statusdead} "fi else echo" ${notExistContainer} "fi} function StartContainer () {sudo docker restart $1} for containerID in ${containerIDs} do for ((iTun1) I
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.