【发布时间】:2018-10-24 22:04:56
【问题描述】:
我创建了工作:ServerCheck。当我想用php artisan schedule:run cron 完成这项工作时,我收到消息:
没有准备好运行的预定命令
为什么?
我的代码:
protected function schedule(Schedule $schedule)
{
$schedule->job(new ServerCheck)->everyTenMinutes();
// $schedule->command('inspire')
// ->hourly();
}
更新
我得到错误:
local.ERROR:参数过多,预期参数“命令”。 {"exception":"[object] (Symfony\Component\Console\Exception\RuntimeException(code: 0): 参数太多,预期参数\"command\"。在
【问题讨论】:
-
你用的是哪个版本的?
-
Laravel 5.6,最新版本
-
您是否在服务器中添加了 Cron 条目 (
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1)? -
没有。我只想使用命令:
php artisan schedule:run -
当
schedule:run命令执行时,Laravel 会评估你的计划任务并运行到期的任务。
标签: php laravel laravel-5.6