Created
November 25, 2025 18:30
-
-
Save tbaschak/32de9d73dac3705d96543b8cd1b90f2a to your computer and use it in GitHub Desktop.
waits for a ping failure, then notifies over discord (when you need to babysit a host)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| DEFAULT_IP="1.1.1.1" | |
| # Assign the first argument to IP, or use DEFAULT_IP if $1 is empty or unset | |
| IP="${1:-$DEFAULT_IP}" | |
| # Loop *while* the host is responding | |
| while ping -c 1 "$IP" &> /dev/null; do | |
| sleep 1 | |
| done | |
| # If we exit the loop, ping failed | |
| # uses https://github.com/NoireNetworks/notify_discord | |
| notify_discord.sh "Host $IP is DOWN" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment