Skip to content

Instantly share code, notes, and snippets.

@the-solipsist
the-solipsist / watch-for-webpage-change-cron.sh
Created June 6, 2023 18:28 — forked from maxme/watch-for-webpage-change-cron.sh
Set this up in a crontab to check if a webpage changed since last check. It will email you the diff when it happens.
#!/bin/sh
checkIfPageChanged() {
URL="$1"
EMAIL_ADDRESS="$2"
CSS_SELECTOR="$3"
SILENT="$4"
tmpfile1=/tmp/$(echo $URL| sha1sum | cut -d" " -f1)
tmpfile2=$tmpfile1-1
curl -L --silent "$URL" -A "Maxme/1.0 (Watching for changes; https://gist.github.com/maxme/c31ffbb3cb21f3baa6e9c9e61bbe0a72)" \