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

Commands are not being run #8

Closed
awalls opened this issue Dec 23, 2016 · 1 comment
Closed

Commands are not being run #8

awalls opened this issue Dec 23, 2016 · 1 comment

Comments

@awalls
Copy link

awalls commented Dec 23, 2016

I have the following set up in a PHP class:

class Cron {
    public function run() {
        $config = [
            "emailFrom" => "cron@example.com",
            "emailTo" => "me@example.com"
        ];
  
        $scheduler = new Scheduler($config);  
        $scheduler->call('myFunc')->every()->minute()->output(APPPATH .'logs/cron.log');
    }

    function myFunc() {
        echo 'Message called from cron');
    }
}

I have a cron setup to call this every minute, however myFunc() never gets called. I can see a run method in the Scheduler class which never gets called. Am I missing something obvious in my setup?

@peppeocchi
Copy link
Owner

Hi, you need to run the scheduler at the end of your run function. Just add $scheduler->run() after you have defined your schedules.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants