I'd like to set up a cron job in unix that would periodically query my MySQL database and email the results to me. So far this is what I've got but it doesnt work...
My unix script contains:
mysql -u<username> -p<password> dbname < batchfile > temp;
mail firstname.lastname@example.org < temp;
My batch file contains:
Select * from tbljobs where jobs_end_date < CURDATE ();
The above statement finds all the expired job postings in the database. Im sure the sql statemtent is correct as I've run it several times.
Do I need to fix/refine this? or is there a better way to do it that will work?