Skip to content

Instantly share code, notes, and snippets.

@skull-squadron
Created July 31, 2011 23:58
Show Gist options
  • Save skull-squadron/1117362 to your computer and use it in GitHub Desktop.
Save skull-squadron/1117362 to your computer and use it in GitHub Desktop.
a tastier beverage
# ping with UTC time
pint(){
local TIMEOUTOPT='W'
case "`uname -s`" in
Darwin) TIMEOUTOPT='t' ;; # -t (seconds) timeout for mac/bsd
Linux) TIMEOUTOPT='W' ;; # -W (seconds) timeout for linux
*) echo "pint() Unsupported system" ; return 1 ;;
esac
while true; do
echo -n "`date -u '+%FT%TZ'` ping $1 "
ping -c1 -${TIMEOUTOPT}1 $1 | grep '_[rs]eq' || echo
sleep 1
done
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment