Testing
Reaching internet connection (macOS)
Sometimes my laptop loose internet connection. Then I usually check reaching sever8.8.8.8 and when it's back (and I did not notice) I want to be informed by "beep" sound.
while true; do
if ping -c 1 8.8.8.8 &> /dev/null; then
printf "%s %s\n" "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" success && afplay /System/Library/Sounds/Funk.aiff
else
printf "%s %s\n" "$(date -u +"%Y-%m-%dT%H:%M:%SZ")" fail
fi;
sleep 5;
done