diff --git a/jobs/credhub/templates/wait_for_uaa.erb b/jobs/credhub/templates/wait_for_uaa.erb index 5f885630..07ee509e 100644 --- a/jobs/credhub/templates/wait_for_uaa.erb +++ b/jobs/credhub/templates/wait_for_uaa.erb @@ -1,14 +1,16 @@ -#!/bin/bash +#!/usr/bin/env bash + +set -euo pipefail <% if p("credhub.authentication.uaa.enabled") %> <% if p("credhub.authentication.uaa.wait_for_start") %> status=`curl --max-time 5 --connect-timeout 2 -k --silent <%= p(["credhub.authentication.uaa.internal_url", "credhub.authentication.uaa.url"]) %>/healthz` -if [ $? -ne 0 ]; then +if [ "$?" -ne 0 ]; then echo "Could not reach the UAA server" exit 1 fi -if [ $status != "ok" ]; then +if [ "$status" != "ok" ]; then exit 1 fi echo "Successfully connected to UAA, continuing startup"