沃梦达 / 编程问答 / php问题 / 正文

Laravel“没有准备好运行的预定命令."

Laravel quot;No scheduled commands are ready to run.quot;(Laravel“没有准备好运行的预定命令.)

本文介绍了Laravel“没有准备好运行的预定命令."的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了以下 Laravel 命令:

I've set up the following Laravel commands:

protected function schedule(Schedule $schedule) {
        $schedule->command('command:daily-reset')->daily();
        $schedule->command('command:monthly-reset')->monthly();
}

然后,在我的服务器上,我设置了一个每天运行一次的 cron 作业(在 00:00).

Then, on my server, I've set up a cron job to run once per day (at 00:00).

0 0 * * * php /home/privates/public_html/staging/current/artisan schedule:run

我的 cron 作业每晚都成功运行,但日志只是说:没有准备好运行的预定命令."

My cron job is running successfully each night, but the logs simply say: "No scheduled commands are ready to run."

我做错了什么?我希望我的 daily 命令每晚运行一次.

What am I doing wrong? I would expect my daily command to run each night.

谢谢!

推荐答案

您是否尝试过手动运行命令?

Did you try running command manually?

运行 php artisan 并查看您的命令是否已注册.

Run php artisan and see if your commands have registered.

如果你已经注册了你的命令,你应该在可用的 artisan 命令列表下看到 command:daily-resetcommand:monthly-reset.

If you have registered your commands you should see command:daily-reset and command:monthly-reset under the list of available artisan commands.

如果您没有看到它们,请继续并通过将其添加到 app/Console/Kernel.php 中的 commands 属性来注册您的命令.

If you don't see them there go ahead and register your commands by adding it to commands property available in app/Console/Kernel.php.

protected $commands = [
    'AppConsoleCommandsYourFirstCommand',
    'AppConsoleCommandsYourSecondCommand'
];

将 crontab 条目更改为

Change crontab entry to

* * * * * php/home/privates/public_html/staging/current/artisan schedule:run

这篇关于Laravel“没有准备好运行的预定命令."的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:Laravel“没有准备好运行的预定命令."

基础教程推荐