|
1
2
3
4
5
6
7
8
9
10
11
12
13
|
#!/bin/bash
###检查docker启动启动
c=`
date
+%F
' '
%T`
a=`
netstat
-a |
grep
docker|
awk
'{print $7}'
`
while
:;
do
if
[
"$a"
==
"LISTENING"
]
then
echo
"$c the docker is startup"
>>
/tmp/dockerstatus
.log
else
echo
"$c the docker is not running"
>>
/tmp/dockerstatus
.log && service docker start
fi
break
done
|
为什么这样的脚本无法检查当docker不是处于listening时候不会检查到停止了而重新启动进程?
本文转自wsw26 51CTO博客,原文链接:http://blog.51cto.com/wsw26/1857919,如需转载请自行联系原作者