Skip to content

Instantly share code, notes, and snippets.

@aarshtalati
Last active March 28, 2018 02:28
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 aarshtalati/b3be0b1948eb8a263c0a4a6dc4afeee3 to your computer and use it in GitHub Desktop.
Save aarshtalati/b3be0b1948eb8a263c0a4a6dc4afeee3 to your computer and use it in GitHub Desktop.
makes sure that database docker container is up and spinning before starting Java SpringBoot application
#!/bin/bash
while ! exec 6<>/dev/tcp/${DATABASE_HOST}/${DATABASE_PORT}; do
echo "Trying to connect to MySQL at ${DATABASE_HOST}:${DATABASE_PORT}..."
sleep 10
done
echo ">> connected to MySQL database! <<"
java -Djava.security.egd=file:/dev/./urandom -Dspring.profiles.active=container -jar /app.jar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment