Skip to content

Instantly share code, notes, and snippets.

View martjanz's full-sized avatar

Martín Anzorena martjanz

View GitHub Profile
@Carolain
Carolain / beepWhenInternet
Last active August 21, 2020 14:22
Keep pinging google.com and beep on success, so I know my flaky connection is working again
#!/bin/bash
echo pinging google.com, will exit on success
echo ctrl+c to force exit
echo will beep on exit
echo
ping_cancelled=false # Keep track of whether the loop was cancelled, or succeeded
until ping -c1 google.com >/dev/null 2>&1; do sleep 60; done & # The "&" backgrounds it
trap "kill $!; ping_cancelled=true" SIGINT