Skip to content

Instantly share code, notes, and snippets.

@ailequal
Last active November 8, 2023 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ailequal/145f21d60eada9e5e31473f08c38bcfe to your computer and use it in GitHub Desktop.
Save ailequal/145f21d60eada9e5e31473f08c38bcfe to your computer and use it in GitHub Desktop.
pinger
#!/bin/bash
#############
# pinger.sh #
#############
# Ping every 30 seconds "192.168.0.1".
# If the ping fails, play a sound for alerting the user.
# The loop can only be stopped manually by the user.
while true; do
if ! ping -c 1 192.168.0.1 > /dev/null; then
echo "Ping failed! Alerting..."
# Choose between one of these methods below.
# paplay /usr/share/sounds/freedesktop/stereo/bell.oga # Play a beep sound.
# mpv "/path/to/custom/audio/file.mp4" # Play any kind of audio.
fi
sleep 30
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment