Is setting up multiple cron jobs the only option for the following?

Hi,

I am building a web application (admin panel) in which the user (admin) will have the ability to set scheduled email notifications. The interface will get the email address, the frequency (once a week, etc.) and hour (at which hour). Once set, an email will be sent to the provided email address at the specified frequency and time until canceled. Similar notifications will be set for multiple (unknown number of) email addresses.

I know how to create a cron job manually via cPanel. But I don’t know how best to handle the above functionality which requires multiple cron jobs to be created programmatically.

How would you handle such a feature? Is setting/editing/deleting multiple cron jobs via PHP my only option?

As a side note, this is hosted on a shared hosting (has 10 cron job limits) but depending on my options about creating the scheduled notifications, moving to a dedicated server could also be an option.

Thanks for any ideas.

Will all go at the same time? Or will there be multiple mails at different times?

If it was at the same time, one cron job would be enough. The system will create notifications for multiple email addresses, at different specified times. Admin will enter an email address, select frequency, select hour, set notification. Admin will do the same for other email addresses for different frequencies and hours.

Perhaps if you run one cronjob every hour.
It checks the time of day, then checks a database to see what should be sent at that time. Would that work for you?

1 Like

Thank you, I will add that to my options list. Actually, it might be my only option I guess.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.