Skip to content

Instantly share code, notes, and snippets.

@sulrich
Last active August 29, 2015 13:56
Show Gist options
  • Save sulrich/8803147 to your computer and use it in GitHub Desktop.
Save sulrich/8803147 to your computer and use it in GitHub Desktop.
check the liveness of the VPN for other stuff
#!/bin/zsh
CHK_URL="http://test-destination-host"
# note you need to redireect STDERR -> STDOUT since wget outputs the headers on STDERR
HEADERS=`wget --server-response --spider --quiet -T 1 -t 1 ${CHK_URL} 2>&1`
HEADERS_RET=$?
if [[ ${HEADERS_RET} == 4 ]] {
echo "some sort of network error occurred"
echo "----------------------------------------------------------------------"
echo ${HEADERS}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment