Created
March 20, 2015 16:24
-
-
Save lucaswerkmeister/169b0163f623692c0154 to your computer and use it in GitHub Desktop.
Watch a website and get emailed on changes
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:?Usage: $0 url [recipient...]}" | |
shift | |
sha=$(curl -s $url | shasum); | |
while [[ $sha = $(curl -s $url | shasum) ]]; do | |
sleep 15; | |
done | |
sendmail=$(type -p sendmail || { [[ -x /usr/sbin/sendmail ]] && echo /usr/sbin/sendmail || { echo "Can’t find sendmail!"; exit 1; }; }); | |
$sendmail -F 'Website Watcher Bot' -f "bot+watcher@$HOSTNAME" "${@:-mail@$HOSTNAME}" << EOF | |
Subject: Website changed | |
Change on $url :) | |
EOF |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment