0

I have setup a command that generates a PDF with some stats and it sends the pdf as an attachment in an email. The command works great when I run t manually in my console.

php artisan send:report

Now I am trying to setup that this command is executed every last day of the month. To test I have setup the scheduler to everyMinute but when I run php artisan schedule:run the email is sent only 1 time when I run the command and not every minute.

Am I doing something wrong here?

My Kernel.php file in Lumen

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

Am I missing something ?

Any help is greatly appreciated !

Many thanks in advance !

Sagar Gautam
  • 9,049
  • 6
  • 53
  • 84
Frank Lucas
  • 551
  • 3
  • 11
  • 25

3 Answers3

3

Please ensure this is on your server Cron entries as described in the docs

* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
Lee
  • 3,044
  • 1
  • 12
  • 25
2

I think you need to set the entry in the crontab. See here: https://laravel.com/docs/5.4/scheduling and scroll down to Starting The Scheduler.

sunomad
  • 1,693
  • 18
  • 23
0

Need to add a cronjob to run the schedule:run command:

Found answer in this issue.

Frank Lucas
  • 551
  • 3
  • 11
  • 25