Skip to content

Instantly share code, notes, and snippets.

@aaronmelton
Created January 6, 2016 17:11
Show Gist options
  • Select an option

  • Save aaronmelton/de19efd9673b67a091c4 to your computer and use it in GitHub Desktop.

Select an option

Save aaronmelton/de19efd9673b67a091c4 to your computer and use it in GitHub Desktop.
#!/bin/bash
TARGET="192.168.1.1"
ping -c3 $TARGET > /dev/null
if [ "$?" -eq "1" ]; then
echo | mail -s "HOSTNAME Unreachable at $(date)" user@email.com
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment