Example: ping google.com until it becomes reachable (for testing when internet connection is back), then notify with an audio message
until ping -W1 -c1 google.com; do sleep 5; done && say connectedIt's also possible to use different notification means (e.g., notify-send on Ubuntu, growl on Mac, pushover, etc.).
Notes on ping:
ping -W1 -c1 google.commeans ping just once (-c1) and wait for reply for 1 second (-W1). It returns 0 if host is reachable, error otherwise.