My goal is to monitor a web page for text and trigger an email to myself either if the text is found, or if it is not, whichever is easier. I know there are some packages out there already to do this, but I'm trying to learn a bit more command line in the process of figuring this out.
The use case is to search for text like "sale starting in" or something like that, so I get an alert when that text is no longer there.
I've done some digging and have the two commands I need, but want to be able to tie them together into a job that I can schedule in cron. A single shell command line would be preferred. I do have perl installed if a script is needed.
An example of a successful search is
curl -s -k http://www.scifi-review.net | grep stettin
result: the source code line with the pattern mach
An example of no result is
curl -s -k http://www.scifi-review.net | grep xxxxxxx
result: just goes back to command line
My email command (I installed an configured ssmtp)
echo "Subject: Test"| ssmtp myemail@domain.com
I'm looking at doing something like this:
If Curl command has NO output, run the email command. (preferred)
or
If Curl command HAS output, run the email command.