Skip to content

Instantly share code, notes, and snippets.

@kurahaupo
Created January 10, 2021 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurahaupo/acde9c5af8f4f532e815cdca342ebd34 to your computer and use it in GitHub Desktop.
Save kurahaupo/acde9c5af8f4f532e815cdca342ebd34 to your computer and use it in GitHub Desktop.
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