docker.sh container_running testgit

This commit is contained in:
fedor 2021-09-30 15:07:17 +07:00
parent cb423f4432
commit 0d666a8405

View File

@ -19,11 +19,10 @@ DCLIST=""
# get all docker containers list of id
DCLIST=`${DOCKER} ps -a | tail -n +2 | awk '{print $1}'`
#show all docker id
# show all docker id
for DOCKERID in ${DCLIST}; do
JSON=${JSON}" {\"{#DOCKERID}\":\"${DOCKERID}\"},"
done
@ -35,6 +34,16 @@ echo ${JSON}
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)
echo "please use these parametrs
{