docker进程检查疑问
|
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时候不会检查到停止了而重新启动进程?