Last active
August 16, 2023 19:09
-
-
Save redpop/0de0afae37c0ff8b16afd1eeffc70f4d to your computer and use it in GitHub Desktop.
Ping Google every 60 seconds
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 | |
GREEN='\033[1;32m' | |
RED='\033[1;31m' | |
NC='\033[0m' # No Color | |
while true; do | |
if ping -c 1 google.com &> /dev/null; then | |
echo -e "${GREEN}$(date): Internet connection is up${NC}" | |
else | |
echo -e "${RED}$(date): Internet connection is down${NC}" | |
fi | |
sleep 60 # Wait for 60 seconds before testing again | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment