Skip to content

Instantly share code, notes, and snippets.

@xeraa
Created December 9, 2013 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xeraa/7874694 to your computer and use it in GitHub Desktop.
Save xeraa/7874694 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Check if our important or publicly communicated URLs are available
set -e
URLS=(
"http://test.com"
"http://test.com/foo"
)
STATUS=0
for URL in "${URLS[@]}"
do
if curl --output /dev/null --silent --head --fail "$URL"
then
echo -e "\x1B[0;32mURL exists: $URL"
else
echo -e "\x1B[0;31mURL does not exist: $URL"
STATUS=1
fi
done
echo -e "\x1B[0mExit code $STATUS" # Reset the color
exit $STATUS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment