Lumen 任务调度每分钟不起作用?

Lumen task scheduling everyMinute isn't working?

我设置了一个命令,该命令生成带有一些统计信息的 PDF,并将 pdf 作为电子邮件的附件发送。当我在我的控制台中手动 运行 t 时,该命令非常有效。

php artisan send:report

现在我正在尝试设置该命令在每个月的最后一天执行。为了测试,我已将调度程序设置为 everyMinute,但是当我 运行 php artisan schedule:run 时,电子邮件仅在我 运行 命令时发送一次,而不是每分钟发送一次。

我是不是做错了什么?

我在 Lumen 中的 Kernel.php 文件

<?php

namespace App\Console;

use App\Console\Commands\SendReport;
use Illuminate\Console\Scheduling\Schedule;
use Laravel\Lumen\Console\Kernel as ConsoleKernel;

class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
        SendReport::class,
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('report:send')->everyMinute();
    }
}

我是不是漏掉了什么?

非常感谢任何帮助!

非常感谢!

需要将 cronjob 添加到 运行 schedule:run 命令:

中找到答案。

请确保这是在您的服务器 Cron 条目上,如文档中所述

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

我认为您需要在 crontab 中设置条目。请参阅此处:https://laravel.com/docs/5.4/scheduling 并向下滚动到启动计划程序。