Beusebiu
Beusebiu

Reputation: 1523

Check if Task Scheduling works on local, Laravel

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)
}

Upvotes: 0

Views: 2194

Answers (2)

Prabu Kannan
Prabu Kannan

Reputation: 133

Change the run intervel to something testable like 5 minutes and try running "php artisan schedule:work".

This command will invoke scheduler every sec and schedule the command for you.

Upvotes: 0

Greedo
Greedo

Reputation: 3559

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

Upvotes: -1

Related Questions