curl check url status

on

Recently we need to check our Route 53 accessibility before invalidating our cache in CDN. So need to add this logic into our Jenkins job.

The command :


r53_url="https://someURL/xx/index.html" 
status_code=$(curl --write-out %{http_code} --silent --output /dev/null ${cf_url})

if [[ "${status_code}" -ne 200 ]] ; then
  echo "Site status is ${status_code}. Make sure ${r53_url} is accessible first!" 
  exit 1
else
  echo "Connectivity to ${r53_url} verified. Invalidating Cache."
  ...
fi

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s