Skip to content

Instantly share code, notes, and snippets.

@thevladsoft
Forked from lucaswerkmeister/watch
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save thevladsoft/ce3c496901f30d7117ea to your computer and use it in GitHub Desktop.

Select an option

Save thevladsoft/ce3c496901f30d7117ea to your computer and use it in GitHub Desktop.
#!/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