开发者

PHP and mySQL Task Scheduler program and database theory?

开发者 https://www.devze.com 2023-03-10 23:54 出处:网络
I need to develop a website that runs jobs at certain times (every 15 minutes) I\'ll use a cron to run the webpage.

I need to develop a website that runs jobs at certain times (every 15 minutes) I'll use a cron to run the webpage.

What is the best way to store the jobs information in? Some jobs will be daily, others every 8 hours etc. To complicate matters, I also need to take into consideration the timezone differences. This shouldn't be too difficult as PHP has many timezone functions, but how do I integrate it in the programming of the next job to run?

Another question, is how will the user enter the information fo开发者_StackOverflow社区r the jobs to run? One option, similar to http://www.webcron.org, is to ask the user to select how often the jobs must run, but how do I store that info in a database?

Any assistance will be greatly appreciated!


I would use the crontab syntax, store it in a DB and run a separate crontab invoking the execution script every minute.

There are GPL classes that do that for you already, like : http://www.phpclasses.org/package/4140-PHP-Database-driven-PHP-job-scheduler-like-cron.html


Create a MySQL Event, that will take care also the storing, recurrence, execution.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号