Implemented excited check

This commit is contained in:
Kevin Veen-Birkenbach 2023-01-09 16:51:19 +01:00
parent 415b47621f
commit 197c0089ee

View File

@ -1,10 +1,20 @@
#!/bin/sh #!/bin/sh
docker_ps_grep_unhealthy="$(docker ps | grep unhealthy)" docker_ps_grep_unhealthy="$(docker ps | grep unhealthy)"
if [ -z "$docker_ps_grep_unhealthy" ] docker_ps_grep_exited="$(docker ps -a | grep Exited)"
exitcode=0
if [ ! -z "$docker_ps_grep_unhealthy" ]
then then
echo "All docker containers are healthy."
exit
else
echo "Some docker containers are unhealthy: $docker_ps_grep_unhealthy" echo "Some docker containers are unhealthy: $docker_ps_grep_unhealthy"
exit 1 exitcode=1
fi fi
if [ ! -z "$docker_ps_grep_exited" ]
then
echo "Some docker containers exited: $docker_ps_grep_exited"
exitcode=2
fi
if [ "$exitcode" -ne "0" ]
then
exit $exitcode
fi
echo "All docker containers are healthy."
exit