-
Notifications
You must be signed in to change notification settings - Fork 64
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
problem with repaet job #17
Comments
Hi Amirkheirabadi, thanks for using cron. Which function is only exectued once? Do you call the Cron route manually? Which operation system is running with Cron? Maybe there is a problem with the overlapping feature. On some Windows systems the lock file could not be deleted. Please have a look in your app/storage/ directory if there is a cron.lock file and please delete it. Use the 'Cron::setDisablePreventOverlapping();' method call to disable the overlapping function. I hope this helps. |
hi liebig ... thanks for reply ... Route::get('/cron/run/c68pd2s4e363221a3064e8807da20s1sf', function () {
Cron::add('example1', '* * * * *', function() {
// Do some thing
return null;
});
$report = Cron::run();
print_r ($report);
}); when i past this code ... function : function() {
// Do some thing
return null;
} only once execute . but i need to execute this function every 1 min for example .. |
Hi amirkheirabadi, okay I understand the problem. A PHP application only runs when you call it (for example via request). Laravel and Cron will be loaded then, executed and after returning the response the application will be termined. It is not possible to run a PHP application over hourse like a Tomcat Server do. So you need something which call the route "/cron/run/c68pd2s4e363221a3064e8807da20s1s" every minute. Cron only checks, if it is executed, which jobs have to be run and which jobs not. So if you only have one job for every minute, you don't need Cron. You can easily do all the business logic in this route without Cron. But if you have a job for every minute, two jobs for every 15 minutes and so on, Cron can help you. "Now we have to ensure that this route is called in an interval. This can be done with renting an own (virtual) server or with an online cronjob service. In both cases Google knows many good providers. An online cronjob service overview can be found at http://www.cronjobservices.com/" Now your server or an online cronjob service will call the Cron route for example every minute, Cron will check which jobs need to be exectued (for example the every minute jobs '* * * * *') and will log the return values. But you always need something which call Cron, because if Cron is not running it is sleeping. |
oh ... thanks ... this is good idea ... |
Unfortunately it is not easily possible to manage crontab with PHP. You need SSH access to the server. You can find a guide here: http://code.tutsplus.com/tutorials/managing-cron-jobs-with-php--net-19428 |
hi ...
I after add new cron , played it ...
But only once the function is executed ...
i use full example in readme ...
What should I do to make this cron will continue ?
The text was updated successfully, but these errors were encountered: