监控docker容器运行状态 shell 脚本:修订间差异
跳转到导航
跳转到搜索
无编辑摘要 |
(没有差异)
|
2020年4月11日 (六) 10:43的最新版本
脚本
# cat mon_docker.sh #!/bin/bash containerName=$1 currTime=`date +"%Y-%m-%d %H:%M:%S"` exist=`docker inspect --format '{{.State.Running}}' ${containerName}` if [ "${exist}" != "true" ]; then docker restart ${containerName} echo "${currTime} 重启docker容器,容器名称:${containerName}" >> /opt/docker.log fi 定时任务crontab */10 * * * * /opt/mon_docker.sh 55fdedd6beaa