Laravel“没有计划的命令准备好运行." [英] Laravel "No scheduled commands are ready to run."

查看:203
本文介绍了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.

谢谢!

推荐答案

您是否尝试运行命令manuallay?

Did you try running command manuallay?

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

Run php artisan and see if your commands have registered.

如果您已经注册了命令,则应该在可用的工匠命令列表下看到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 = [
    'App\Console\Commands\YourFirstCommand',
    'App\Console\Commands\YourSecondCommand'
];

将crontab条目更改为

Change crontab entry to

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

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

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆