-1

I have a problem with laravel command

    <?php

namespace App\Console;

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
use Illuminate\Foundation\Bus\DispatchesJobs;

class Kernel extends ConsoleKernel
{
    use DispatchesJobs;

    protected $commands = [
        Commands\checkDeposits::class,
    ];

    protected function schedule(Schedule $schedule)
    {
      $schedule->command('check:deposits')->everyFiveMinutes();
    }
}

The command is not executed every five minutes ...

Its not executed at all. If i use php artisan check:deposits it works.

Why the command is not scheduled to run every 5 minutes ?

Also tried php artisan schedule:run

output : No scheduled commands are ready to run.

Al3x
  • 19
  • 4

1 Answers1

0

Add the following line to the crontab of your server:

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

This will execute the Laravel command scheduler every minute.

Also, include the class of your command in Kernel.php (case sensitive):

use Commands\CheckDeposits;

And include it in the $commands array:

protected $commands = [
    CheckDeposits::class,
];
piscator
  • 8,028
  • 5
  • 23
  • 32
  • Executed the command but the scheduler didnt run... – Al3x Nov 28 '17 at 10:31
  • Executed : php -d register_argc_argv=On /var/www/html/project/artisan schedule:run >/dev/null 2>&1 And i think its working.. – Al3x Nov 28 '17 at 10:37
  • @Al3x Perhaps there's something wrong with the reference in your $commands array. Check the updated answer. – piscator Nov 28 '17 at 10:37