0

I am using Task Scheduling from Laravel, on local env. and till now I test it with php artisan word:weeklyUpdate , but I want to check if the Cron Job run automatically on a specific date, like in my code.

protected function schedule(Schedule $schedule)
{
    $scheduler = new LkpSchedulerUpdateDate;
    $scheduler = $scheduler->first()->toArray();

    $schedule->command('word:weeklyUpdate')->weeklyOn($scheduler->date, $scheduler->time);
    //ex: weeklyOn(3, 05:49:00)
}
Beusebiu
  • 1,433
  • 4
  • 23
  • 68
  • Does this answer your question? [Configure and Test Laravel Task Scheduling](https://stackoverflow.com/questions/40161679/configure-and-test-laravel-task-scheduling) – PiTheNumber Nov 09 '20 at 11:56
  • I think those answers still apply: https://stackoverflow.com/a/45813748/956397, https://stackoverflow.com/a/49051226/956397 – PiTheNumber Nov 09 '20 at 11:57

1 Answers1

-1

Create a schedule that runs just some minuts after the current time (let's say 5 minuts from now), wait, then check the results.

Edit: It's because when you run php artisan word:weeklyUpdate` you execute the command directly.

The scheduled task your wrote is equivalent to execute php artisan word:weeklyUpdate in console every week. Also, in your locale did you activated the cronJob scheduler? * * * * * cd /path-to-your-project && php artisan schedule:run >> /dev/null 2>&1

Greedo
  • 3,438
  • 1
  • 13
  • 28
  • 1
    That's what I am trying to do, but with php artisan word:weeklyUpdate it runs instantlly, even if I have everyFiveMinutes(); – Beusebiu Jun 24 '20 at 12:42