Skip to content

Instantly share code, notes, and snippets.

@tbaschak
Created November 25, 2025 18:30
Show Gist options
  • Select an option

  • Save tbaschak/32de9d73dac3705d96543b8cd1b90f2a to your computer and use it in GitHub Desktop.

Select an option

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)
#!/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