docker.sh container_running testgit
This commit is contained in:
parent
cb423f4432
commit
0d666a8405
@ -19,11 +19,10 @@ DCLIST=""
|
|||||||
|
|
||||||
|
|
||||||
# get all docker containers list of id
|
# get all docker containers list of id
|
||||||
|
|
||||||
DCLIST=`${DOCKER} ps -a | tail -n +2 | awk '{print $1}'`
|
DCLIST=`${DOCKER} ps -a | tail -n +2 | awk '{print $1}'`
|
||||||
|
|
||||||
|
|
||||||
#show all docker id
|
# show all docker id
|
||||||
for DOCKERID in ${DCLIST}; do
|
for DOCKERID in ${DCLIST}; do
|
||||||
JSON=${JSON}" {\"{#DOCKERID}\":\"${DOCKERID}\"},"
|
JSON=${JSON}" {\"{#DOCKERID}\":\"${DOCKERID}\"},"
|
||||||
done
|
done
|
||||||
@ -35,6 +34,16 @@ echo ${JSON}
|
|||||||
exit 0
|
exit 0
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
# get container status
|
||||||
|
docker.container_running)
|
||||||
|
|
||||||
|
RET=`${DOCKER} stats --no-stream | tail -n +2 | awk -v IT="${ITEM}" ' BEGIN {$count=0;} { if ($1 == IT) count += 1 } END {if (count > 1) print ""; else if (count == 1) print 1; else if (count == 0) print 0} '`
|
||||||
|
echo ${RET}
|
||||||
|
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
|
||||||
help)
|
help)
|
||||||
echo "please use these parametrs
|
echo "please use these parametrs
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user