Add files via upload

This commit is contained in:
Kris-Sekula 2016-11-16 22:30:11 +00:00 committed by GitHub
parent 91def7856f
commit 4448b97536
1 changed files with 21 additions and 0 deletions

21
mailmyip.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
#sleep 120
((count = 1000)) # Maximum number to try.
while [[ $count -ne 0 ]] ; do
ping -c 1 8.8.8.8 # Try once. or put address that is ping-able.
rc=$?
if [[ $rc -eq 0 ]] ; then
((count = 1)) # If okay, flag to exit loop.
fi
((count = count - 1)) # So we don't go forever.
done
if [[ $rc -eq 0 ]] ; then # Make final determination.
echo 'say The internet is back up.'
ip=$(hostname -I)
echo "$ip" | mail -s "New IP of $(hostname)" to@domain.com
else
echo 'say Timeout.'
fi