Created
September 2, 2022 14:08
-
-
Save sdubois/ff41185fa8bf085fbfce719ec6c9a3ca to your computer and use it in GitHub Desktop.
Monitors an IP address to see if it is accessible. Useful for uptime monitoring and testing.
This file contains hidden or 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 | |
# Monitors an IP address to see if it is accessible. Useful for uptime monitoring and testing. | |
# Ex: bash ping-checker.sh 8.8.8.8 | |
while true | |
do | |
ping -c1 $1 | grep -q '0 packets received' && echo 'down' | |
ping -c1 $1 | grep -q '1 packets received' && echo 'up' | |
sleep 120 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment