Skip to content

Instantly share code, notes, and snippets.

@Bersam
Created May 6, 2018 07:44
Show Gist options
  • Save Bersam/a8df30cf1f60179f9deb0f33ebe4fbfc to your computer and use it in GitHub Desktop.
Save Bersam/a8df30cf1f60179f9deb0f33ebe4fbfc to your computer and use it in GitHub Desktop.
#!/bin/bash
while read line
do
SERVERIP=$line
NOTIFYEMAIL=admin@pooyeshdarou.com
ping -c 3 $SERVERIP > /dev/null 2>&1
if [ $? -ne 0 ]
then
# Use your favorite mailer here:
#mailx -s "Server $SERVERIP is down" -t "$NOTIFYEMAIL" < /dev/null
echo "Server $SERVERIP is down"
fi
done < "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment