1

I have a Laravel project running via XAMPP on my local Windows 10 machine, and I want to set up the Laravel task scheduler (https://laravel.com/docs/5.8/scheduling) to run so that I can test out cron jobs locally.

I followed the following instructions for trying to set this up: https://gist.github.com/Splode/94bfa9071625e38f7fd76ae210520d94

Then, in my Laravel project, I have the following simple task in the app\Console\Kernel.php file to test it:

protected function schedule(Schedule $schedule) {
    $schedule->call(function () {
        $log = new Log;
        $log->type = 'minute_task';
        $log->data = '';
        $log->save();
    })->everyMinute();
}

If I manually run the task from the scheduler, it works and properly logs in the DB, but if I just let it sit there, it never seems to run. I've waited up to 10 minutes with nothing being logged in the DB.

Any ideas on what I might be doing wrong? Thanks.

Here're some screenshots of what I have set (minus any personal information):

enter image description here

enter image description here

enter image description here

enter image description here

enter image description here

HartleySan
  • 7,404
  • 14
  • 66
  • 119

1 Answers1

3

Sorry for any confusion caused by those of you nice enough to try to answer my question. I figured it out though. When you first set the job up / edit it, under the Edit Trigger window accessible from the Triggers tab then editing the trigger, you have to set the start date AND time for some time in the future. I edited the task and set the start time for today and one minute in the future, and then it instantly started working every minute, on the minute. That wasn't obvious in the docs I read or when I set it up, but that was the problem. Thanks again, everyone.

HartleySan
  • 7,404
  • 14
  • 66
  • 119
  • For me it simply does not trigger the job if I set it to 1 minute, but works fine if it's 5 minutes. – Simbiat Jun 05 '21 at 15:39
  • I'm not honestly sure, Simbiat. I haven't touched this stuff in a while, but I remember it working for me. If you figure it out, please do post your solution here. Thanks. – HartleySan Jun 06 '21 at 01:51
  • 2
    Thank you, your answer help me. However I found that change **Begin the task** to **At task creation/modification** and set **Activate:** to any specific date/time also work too. – vee Jan 15 '22 at 13:24
  • Didn't know that, vee. Thanks for commenting. – HartleySan Jan 15 '22 at 14:53