Created
January 10, 2021 14:23
-
-
Save kurahaupo/acde9c5af8f4f532e815cdca342ebd34 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
status= | |
dikf() { | |
z=$( docker inspect "$k" -f "{{.State.$1}}" ) | |
[[ $z = $2 ]] | |
} | |
while | |
read -r k | |
do | |
SECONDS=0; | |
while | |
! dikf Running true || { | |
! dikf Status exited && | |
! dikf ExitCode 0 | |
} | |
do | |
((SECONDS < 60)) || exit 1 | |
sleep 1 | |
done & | |
kk[$!]=$k | |
done < <( | |
docker-compose ps --services | |
) | |
for pid in "${!kk[@]}" | |
do | |
k=${kk[$pid]} | |
if wait "$pid" | |
then : | |
else | |
prinf '[ERROR] Timeout for %s\n' "$k" | |
status=failed | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment