Skip to content

Instantly share code, notes, and snippets.

@khmarochos
Last active April 16, 2016 07:43
Show Gist options
  • Save khmarochos/6566f80c4e369b699747deadb1d6b183 to your computer and use it in GitHub Desktop.
Save khmarochos/6566f80c4e369b699747deadb1d6b183 to your computer and use it in GitHub Desktop.
Ping the Host and Trace the Route
TARGET=13.13.13.13; while :; do { PL=$(ping -c 10 -W 1 "${TARGET}" | sed -n -r 's/^.+ ([0-9]{1,3})% packet loss.+/\1/gp'); if [[ "${PL}" -gt 25 ]]; then { echo "$(date): ${PL}% of requests haven't got any responses"; mtr -i 0.1 -r -c 10 "${TARGET}"; echo; } fi; } done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment