Article 6K5AN [XMLStarlet + CRON] Check if string in HTML page, email if not

[XMLStarlet + CRON] Check if string in HTML page, email if not

by
littlebigman
from LinuxQuestions.org on (#6K5AN)
Hello,

I need to write a CRON job to watch a web page for a given string, and send an email in case it's no longer there (opening subscriptions).

XMLStarlet seems like the tool for this. Would someone have a Bash script I could start with?

Tentative script:
Code:#!/bin/bash

#How to know if string is no longer there, and email accordingly?
wget -O - http://www.acme.com | xml sel -t -v "<span class="alert">Some string</span>"

printf 'From: me@myisp.com\nTo: me@myisp.com\nSubject: Site updated' "String is gone." | msmtp -tThank you.
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments