Last active
September 27, 2021 10:07
-
-
Save MatthiasKainer/3026d0a06c13159f6ec3b58924322e02 to your computer and use it in GitHub Desktop.
[MacOS][workflow] Notify me when a website is back again. Call like this: `./tell-me-when-site-is-back.sh https://matthias-kainer.de &` (replace my homepage with yours...)
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 | |
URL="$1" | |
while true; do | |
OUTPUT_FILE=$(mktemp) | |
HTTP_CODE=$(curl --silent --output $OUTPUT_FILE --write-out "%{http_code}" "$URL") | |
if [ $? -lt 399 ] | |
then | |
osascript -e "display notification \"$URL is back\"" | |
break | |
fi | |
sleep 5 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment