diff --git a/compose/startup-order.md b/compose/startup-order.md index a9b1a5e081..e432ee1810 100644 --- a/compose/startup-order.md +++ b/compose/startup-order.md @@ -68,14 +68,25 @@ script: set -e host="$1" + # Shift arguments with mapping: + # - $0 => $0 + # - $1 => + # - $2 => $1 + # - $3 => $2 + # - ... + # This is done for `exec "$@"` below to work correctly shift + # Login for user (`-U`) and once logged in execute quit ( `-c \q` ) + # If we can not login sleep for 1 sec until PGPASSWORD=$POSTGRES_PASSWORD psql -h "$host" -U "postgres" -c '\q'; do >&2 echo "Postgres is unavailable - sleeping" sleep 1 done >&2 echo "Postgres is up - executing command" + # Print and execute all other arguments starting with `$1` + # So `exec "$1" "$2" "$3" ...` exec "$@" ```