Skip to content

Instantly share code, notes, and snippets.

@Brunomm
Created February 5, 2019 19:58
Show Gist options
  • Save Brunomm/f6e26899002a86f614de794316ccf801 to your computer and use it in GitHub Desktop.
Save Brunomm/f6e26899002a86f614de794316ccf801 to your computer and use it in GitHub Desktop.
Docker script for await mssql start
#!/bin/sh
# wait-for-mssql.sh
set -e
# host="$1"
shift
cmd="$@"
until /opt/mssql-tools/bin/sqlcmd -S "${DB_HOST}" -U "${DB_USER}" -P "${DB_PASSWORD}" -Q 'exit'; do
>&2 echo "Database is unavailable - sleeping"
sleep 1
done
>&2 echo "Database is up - executing command"
exec $cmd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment