Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save krasnuydyx/8e73196dd1b2aa71462b6e39b01c62d6 to your computer and use it in GitHub Desktop.
Save krasnuydyx/8e73196dd1b2aa71462b6e39b01c62d6 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
function status {
docker inspect $1 | grep Status | awk '{print $2}'
}
cont="nginx-srv registry-web registry-srv"
get_regex="^.*running.*$"
for i in $cont
do
get_status=$(status ${i})
if [[ $get_status =~ $get_regex ]]; then
echo "Container ${i} is running"
else
echo "Container ${i} is not running, restarting"
/root/registry/run-registry.sh
exit 0
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment