开发者

any crontab alternative that you can start,stop, pause,resume, reschedule via an API in PHP? [closed]

Closed. This question is seeking recommendations for books, tools, software libraries, and more. It does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

开发者_开发问答

Closed last month.

Improve this question

Do you know crontab alternative that you can start,stop, pause,resume, reschedule via an API in PHP?

Or is this possible in crontab?

I have a long running php script that is executed by a cron. I would have to pause cron (while the script is executing) or reschedule so that it doesn't re-run my php script while it is still executing. After the script runs I would start the cron again.


You might want to add the locking logic into your PHP script. E.g. the script might check for the presence of a lock file and abort if it is present. Otherwise it would create that file and delete it after it is done. You can add additional logic into your script for example checking the last time it was run and abort if it was last run less than 1 hour ago.

As for cron job, you can set up aggressive timings (say every 5 minutes) based on the assumption that the script is responsible for checking locks, last run time etc.


You should try a job queue.

There are some implemented in pure PHP (Like the Zend Job Queue) or install a deamon service like beanstalkd (With a PHP-API like Pheanstalk.)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜