Laravel scheduler is not running automatically

好久不见. 提交于 2019-12-08 05:42:11

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/31993033/laravel-scheduler-is-not-running-automatically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!