时间表:没有准备好运行的预定命令

问题描述 投票:0回答:2

我的app / console / kernel.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 = [
        //
    ];

    /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        // $schedule->command('inspire')
        //          ->hourly();
        $schedule->command('telescope:prune')->daily();
        $schedule->command('synergy:sync')->everyMinute();
    }

    /**
     * Register the commands for the application.
     *
     * @return void
     */
    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}

我在我的crontab中添加了:

/ usr / bin / php /home/admin/web/domain.com/public_html/artisan schedule:run

当我运行(在控制台中)php artisan schedule:run时,我得到了:“没有预定的命令可以运行。”

我该如何解决?

laravel scheduler
2个回答
0
投票

手动运行时,您可以在某一分钟的某个时间运行它。当没有cron匹配特定分钟时,这将是预期的输出。

通过在crontab中将其定义为

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

你每分钟运行一次,这将在调度程序有事可做时触发一个工作。


0
投票

Laravel处于维护模式,调度程序不在维护模式下工作。

© www.soinside.com 2019 - 2024. All rights reserved.