test of ICMP block
Posted
by
Marcos
on Super User
See other posts from Super User
or by Marcos
Published on 2012-06-13T10:36:13Z
Indexed on
2012/06/13
10:42 UTC
Read the original article
Hit count: 430
In my bash scripts I have been using something like:
until fping -u google.com; do echo "$0[$$] Network/DNS down?? $(date)" 1>&2 && sleep $(($RANDOM%(1 + ++trynum * 1) +1)).222; done
to test for online connectivity.
It halts in place, sleeping growing random intervals, until it can ping google.com again.
Problem: At some sites ICMP pings are blocked altogether, and web pages are still reachable. What's a short way to test for this general case?
Based on that test I will switch over to an http-based test like the exit status of
curl -s google.com >/dev/null
if that is a good one.
© Super User or respective owner