unix - c program sending error from DB to email

hi,

i have a database table that automatically logs the errors in the database every 5 mins.

what i want to happen is to come up with a program using unix-c that gets all the information from the log table, i have a flag initially set to zero which means that the error is not yet sent, the flag will automatically be changed to 1 once the error is already sent.

i hope you can help me regarding this matter.
thank you so much!

you can also email me on this address:
Removed

Please read our rules and note:
(10) Don't post your email address and ask for an email reply. The forums are for the benefit of all, so all Q&A should take place in the forums.

Here is some thing to start with ...
Loop this for every 5 minutes.

Or setup cron to run every 5 minutes ...


grep "error string"  logfile
if test $? -eq 0
then
    flag=1
fi