I am fairly new to creating server scripts and jobs that the server runs every day.
My problem is as follow:
I want to send an email to my users reminding them of a specific job they have to do.
My idea:
Database -> collect all users who needs to be notified and insert them into a table notify_user
Script -> find all users and send them a mail
Script -> Delete all from the table
This script will then run at a specific time every day for instance every 24th hour.
As I stated earlier I am not really keen on how to setup such a script.
My server is an Ubuntu server and my application is a PHP program.
Does anyone know how I might achieve this or know where I might find some documentation on this subject since I have been unable to find anything that solves this issue.
If given that you know how to populate the 'notify_user' table then these are my steps to reproduce a solution sample for you. I did this on my VPS server with sendmail daemon running.
After creating this sample database we should populate it with at least 2 users (for testing) with working emails. I changed here the actual emails I used.
Now we should write a script that gets these details and sends emails:
Now it's time to put this script on cron:
This will run your script exactly every midnight. If you want to set a more specific hour, look at this tutorial: http://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
Hope this helps ^)