Skip to content

Instantly share code, notes, and snippets.

@MatthiasKainer
Last active September 27, 2021 10:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MatthiasKainer/3026d0a06c13159f6ec3b58924322e02 to your computer and use it in GitHub Desktop.
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...)
#!/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