Skip to content

Instantly share code, notes, and snippets.

@allenhwkim
Created February 9, 2015 22:49
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 allenhwkim/280f271078148f69c4b6 to your computer and use it in GitHub Desktop.
Save allenhwkim/280f271078148f69c4b6 to your computer and use it in GitHub Desktop.
Server Status Check Bash Script
!/bin/bash
i=0; array=();
array[(i++)]="-X POST http://my.server.com:3000/path"
array[(i++)]="-X GET http://my.server.com:4000"
for LINE in "${array[@]}"
do
curl -o /dev/null --silent --head -m 1 --write-out '%{http_code}' $LINE
echo " $LINE"
done
# Output Example
# 404 -X POST http://my.server.com:3000/path
# 200 -X GET http://my.server.com:4000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment