I would say the easiest way to do something like this is to simply
forward the incoming messages to your external e-mail address. To do
this, simply create a file named .forward in your home directory that
contains your external e-mail address (for some UNIX/mail
configurations the .forward file has to be placed in your mail
directory). But this way you'll get ALL incoming mail forwarded.
Now getting back to your request... let's split it in two parts:
1. The "script" to send the mail if a string is found in a file is
(assuming you're familiar with UNIX' shell):
[ -n "`cat FILE | grep STRING`" ] && echo "MESSAGE" | mail -s "SUBJECT" ADDRESS
where: FILE is the file to be parsed for the occurence of the string
STRING and MESSAGE is the message to be send to the e-mail address
ADDRESS, having the subject SUBJECT.
2. The cron job syntax:
<min> <hour> <day/month> <month> <day/week> <command>
where <min> = minute (0-59), <hour> = hour (0-23), <day/month> = day
of the month (1-31), <month> = month of the year (1-12), <day/week> =
day of the week (0-6 with 0=Sunday) and <command> is the command to be
executed
E.g. 0 * * * * <command> --> will execute <command> every hour.
If you wish to execute it only during the weekdays write it as: 0 * *
* 1-5 <command>
So, putting it all together, here is what you have to add to your
crontab (crontab -e):
0 * * * * [ -n "`cat FILE | grep STRING`" ] && echo "MESSAGE" | mail
-s "SUBJECT" ADDRESS |