wait_for_db.sh 289 B

12345678910111213141516171819
  1. #!/bin/sh
  2. case $DBMS in
  3. "postgres")
  4. CMD="pg_isready -hdb -q -Upostgres"
  5. ;;
  6. "mariadb")
  7. CMD="mysqladmin ping --silent -hdb -uroot -p${MYSQL_ROOT_PASSWORD}"
  8. ;;
  9. *)
  10. exit 1
  11. esac
  12. while ! $CMD;
  13. do
  14. echo "Waiting for DB..."
  15. sleep 3
  16. done