Skip to content

Instantly share code, notes, and snippets.

Last active Apr 16, 2016
What would you like to do?
Ping the Host and Trace the Route
TARGET=; 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