简体   繁体   English

Laravel调度与多个呼叫冲突

[英]Laravel Scheduling conflicts with multiple calls

I am using Laravel Task Scheduling 我正在使用Laravel 任务计划

I need to run multiple tasks at different times, like this: 我需要在不同时间运行多个任务,就像这样:

protected function schedule(Schedule $schedule) {
    $schedule->call('App\Http\Controllers\SomeController@job1')->daily();
    $schedule->call('App\Scheduled\SomeClass@job2')->hourly();
    $schedule->call('App\Scheduled\SomeClass@job3')->hourly();
    $schedule->call('App\Scheduled\SomeOtherClass@job4')->daily();
}

But for some reason everything runs once a day (at 12:00am). 但由于某些原因,一切都正常运行,每天一次(上午12:00)。 What am I doing wrong? 我究竟做错了什么?

That sounds like your cron job is only running artisan schedule:run once per day. 听起来您的Cron工作只是按照artisan schedule:run每天artisan schedule:run一次。 Make sure your cron job is set up like the docs: 确保您的cron作业像文档一样设置:

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

The * * * * * part means run every minute, and then Laravel will decide which tasks to run each minute based on your schedule. * * * * *部分表示每分钟运行一次,然后Laravel将根据您的日程安排决定每分钟运行哪些任务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM