2017-06-12 41 views
0

我已经设置了一个命令,生成一个带有一些统计信息的PDF,它发送pdf作为电子邮件中的附件。当我在控制台中手动运行t时,该命令很好用。流明任务调度everyMinute不工作?

php artisan send:report 

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

我在这里做错了什么?

管腔

<?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(); 
    } 
} 

我Kernel.php文件我缺少的东西?

任何帮助,非常感谢!

非常感谢提前!

+0

你可以添加命令行为代码吗? –

+0

@Sagar该命令的工作原理,我测试它通过运行它manualy php artisan报告:发送。但我认为问题是我没有设置一个cronjob来运行日程表 –

+0

@FrankLucas是的,这是问题所在。 – sisve

回答

0

需要添加一个cronjob运行计划:运行命令:

this issue找到答案。

2

请确保这是您的服务器的Cron条目在文档

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