[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.
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.