2

我正在尝试 Laravel schedule 命令来运行一些后台进程来发送邮件和获取电子邮件。当我使用 artisan 单独运行这些命令时,它们都会运行,但是当我尝试运行 shcedule:run 命令来运行这些命令时,它会显示“没有计划的命令准备好运行”。

我试图寻找答案,但没有任何效果。所以我试图通过运行简单的命令来纠正这个问题并检查输出。下面是我的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);
    }
}

当我运行 schedule:run 它显示这个输出。

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
        }

但是当我在 schedule() 函数中删除 dd() 时,输出是

没有计划的命令准备好运行。

谁能帮助我并告诉我我做错了什么。

4

1 回答 1

2

查看storage/framework文件夹中的类似文件schedule-d71c52cd9f206ba2359601745a5ad13d51fa7ca6

如果有 - 删除它们并尝试schedule:run再次运行命令。

于 2017-01-10T19:09:17.687 回答