Created
April 13, 2020 19:35
-
-
Save akantsevoi/8a46cdf773719ce3529b0502e6ef9023 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
#!/bin/sh | |
if [[ -z "$1" || -z "$2" ]]; then | |
{ echo "empty parameters $1 - MYSQL_HOST $2 - after run script"; exit 1; } | |
fi | |
MYSQL_HOST=$1 | |
SECONDS_CHECK=40 | |
echo "Check db: $MYSQL_HOST" | |
while ! mysqladmin ping -h"$MYSQL_HOST" --silent; do | |
sleep 1 | |
SECONDS_CHECK="$(($SECONDS_CHECK-1))" | |
if [ "$SECONDS_CHECK" -lt 0 ]; then | |
{ echo "DB doesn't answer $MYSQL_HOST"; exit 1; } | |
fi | |
echo "Wait $SECONDS_CHECK" | |
done | |
echo "DB responses" | |
sh $2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment