Last active
December 12, 2015 05:38
-
-
Save esdrasbeleza/4722683 to your computer and use it in GitHub Desktop.
A script to verify if my connection is up and running. Put it to run in your crontab and you can have logs of your broadband internet connection, for example. Call $ check_connection.sh > output.log
This file contains 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/sh | |
datetime=`date +%Y-%m-%d\ %H:%M:%S` | |
my_ip=`curl -s ifconfig.me` | |
exit_code=$? | |
if [ $exit_code == 0 ]; then | |
echo $datetime [ONLINE] $my_ip | |
else | |
echo $datetime [OFFLINE] Exit code: $exit_code | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment