Laravel schedule:run does not work

2.3k views Asked by At

I am trying Laravel schedule command to run some background process for sending mails and fetching emails. When I run these commands individually using artisan they all run, but when I try to run shcedule:run command to run these commands it shows "No scheduled commands are ready to run."

I've tried to look for an answer but nothing worked. So I tried to rectify the problem by running simple command and check the output. Below is my kernal.php

<?php
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
    /**
     * The Artisan commands provided by your application.
     *
     * @var array
     */
    protected $commands = [
         Commands\Inspire::class,
    ];
    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
         $schedule->command('inspire')
                  ->everyMinute();
         dd($schedule);
    }
}

when I run schedule:run it shows this output.

Bhanu-Slathias-MacBook-Pro:Faveo-Helpdesk-Pro-bhanu-fork vijaysebastian$ php artisan schedule:run
    Illuminate\Console\Scheduling\Schedule {#54
      #events: array:1 [
        0 => Illuminate\Console\Scheduling\Event {#1663
          +command: "'/Applications/AMPPS/php-5.6/bin/php' 'artisan' inspire"
          +expression: "* * * * * *"
          +timezone: null
          +user: null
          +environments: []
          +evenInMaintenanceMode: false
          +withoutOverlapping: false
          +runInBackground: false
          #filters: []
          #rejects: []
          +output: "/dev/null"
          #shouldAppendOutput: false
          #beforeCallbacks: []
          #afterCallbacks: []
          +description: null
        }

But when I remove dd() in schedule() function the output is

No scheduled commands are ready to run.

Can anyone help me and tell what I am doing wrong.

1

There are 1 answers

1
Andrew P. On

Check out the storage/framework folder for files like that schedule-d71c52cd9f206ba2359601745a5ad13d51fa7ca6

If any - delete them and try to run schedule:run command again.