Published on [Permalink]
Reading time: 2 minutes

And now for something completely different.

I wrote a dumb little shell script to watch the USCCB’s website for any updates to their ongoing overhaul of the Liturgy of the Hours. If anything changes, the script DMs me on our family’s Slack channel. Why Slack? The price is right and the younger ones without phones can participate. It’s been great fun for general silliness, sharing pictures, and general announcements like we’re starting Boba Fett in 10 minutes.

I’ve also come to appreciate Slack’s webhook feature, which makes it a cinch to post data to a channel. Among other things, I’ve got a script that uses rtl_433 to monitor my wireless grill thermometer and send temperature updates so I can keep an eye on things when I have to be elsewhere.

In any event, this is what I came up with after liberally borrowing from similar things I found online:



mv new.html old.html 2> /dev/null
lynx --dump -nolist $URL > new.html
DIFF_OUTPUT="$(diff --changed-group-format='-%<+%>' --unchanged-group-format='' new.html old.html)"
if [ "0" -ne "${#DIFF_OUTPUT}" ]; then

    message="LOTH Website has been updated:^M"$DIFF_OUTPUT

    curl -X POST -H 'Content-type: application/json' \
            --data "$(jq -n --arg var "$message" '.text = $var')" \

Why lynx? For a page that doesn’t change very often, the USCCB’s CMS uses enough javascript that changes and I was getting false alarms. Lynx will dump out the content and leave all the cruft behind. The ‘nolist’ option suppresses the URL list which is normally appended to the output.

I wanted to see the actual changes in the message, so I found a concise bit of formatting for diff’s output

Another tip of the hat to ‘jq’ which, once again, makes dealing with JSON a snap. This runs as a daily cron job. Now I’ll be all in the loop whenever something happens. In the spirit of sharing, take this and go nuts if it’s useful to you.