Laravel quot;No scheduled commands are ready to run.quot;(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-reset 和 command: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“没有准备好运行的预定命令."
基础教程推荐
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 如何替换eregi() 2022-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
