Last active
January 17, 2018 11:27
-
-
Save hugo/a9d4864c6b4b20629da3ba61a03a4769 to your computer and use it in GitHub Desktop.
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/bash | |
log_file="/var/log/am_i_up.log" | |
log() { | |
echo "$(date) $1" >> $log_file | |
} | |
if ping -c 1 8.8.8.8 > /dev/null 2>&1; then | |
log "network up" | |
else | |
log "network down" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment