Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel scheduler is not running automatically

I have made a scheduler. When I call it with php artisan userRanking it works.

This is the code in Kernel.php:

protected $commands = [
    \App\Console\Commands\UserRanking::class,
];

protected function schedule(Schedule $schedule)
{
    $schedule->command('userRanking')
             ->everyMinute();
}

How do I dispatch it so that it runs automatically?

like image 968
Wolfgang Müller Avatar asked Dec 14 '22 12:12

Wolfgang Müller


1 Answers

You have to set up a single cron job that calls the schedule runner every minute:

* * * * * php /path/to/artisan schedule:run 1>> /dev/null 2>&1

Read Laravel's Scheduler docs for more info.

like image 156
Joseph Silber Avatar answered Dec 17 '22 02:12

Joseph Silber