Skip to content
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

Corn job execute only once #51

Closed
NageshA opened this issue Dec 30, 2014 · 2 comments
Closed

Corn job execute only once #51

NageshA opened this issue Dec 30, 2014 · 2 comments
Labels

Comments

@NageshA
Copy link

NageshA commented Dec 30, 2014

Iam using your example code in global.php
Event::listen('cron.collectJobs', function() {

Cron::add('send email', '* * * * *', function() {
    mail('abc@gmail.com', 'My Subject', 'message');
    return null;
});


Cron::add('disabled job', '0 * * * *', function() {
    // Do some crazy things successfully every hour
}, false);

});

And when I do http:root/cron.php?key=$key

only Once cron job will execute and table also get updated once.How to execute this function every minute ?

@JanEltner
Copy link

HI NageshA,

You need for example an online cronjob service, which runs your route every minute. This is because PHP only runs, if it is executed. You can see this in the FAQ(https://github.com/liebig/cron#faq):

"In comparison to a Java application server for example, PHP only runs if it is executed. If crontab or an online cronjob service provider calls PHP and starts the application, Cron can execute the jobs and will start the work. If PHP is not started, the application sleeps and nothing happens. "

Best Regards,

JanEltner

@liebig liebig added the question label Jan 5, 2015
@liebig
Copy link
Owner

liebig commented Jan 8, 2015

Closed due to inactivity.

@liebig liebig closed this as completed Jan 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants