首页 > 解决方案 > 没有计划的命令准备好运行。拉拉维尔 8

问题描述

我正在尝试使用调度程序每分钟运行一次命令,但调度程序:运行打印没有计划的命令准备好运行。信息。据我了解,如果我想通过运行命令测试 shcedulder,我不需要设置 cronjob。任何如何解决这个问题的建议表示赞赏

我的命令:

/**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'print:log';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = 'Print in log';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return int
     */
    public function handle()
    {
        info('message from command');
    }

内核.php

    protected $commands = [
        'App\Console\Commands\PrintLog',
    ];

    protected function schedule(Schedule $schedule)
    {
        $schedule->command('print:log')->everyMinute();
    }

标签: laravelscheduler

解决方案


你可以试试吗?

       protected $commands = [
            Commands\PrintLog::class,
        ];
    
        protected function schedule(Schedule $schedule)
        {
            $schedule->command('print:log')->everyMinute();
        }

推荐阅读