[英]Laravel CRON job not working in aws
我已经在 AWS Ubuntu 16.04 apache2 中部署了 laravel 5.4 应用程序,我已经创建了用于发送电子邮件dailyAt('10:00')
任务调度程序。
当我运行 artisan 命令时php artisan email:reminder
手动一切正常。
但是,当我运行php artisan schedule:run
时,我得到No scheduled commands are ready to run.
我还运行了* * * * * php /var/www/html/app/artisan schedule:run >> /dev/null 2>&1
参考文档。
这是Kernal.php
class Kernel extends ConsoleKernel
{
protected $commands = [
\App\Console\Commands\EmailReminder::class,
];
protected function schedule(Schedule $schedule)
{
$schedule->command('email:reminder --force')->dailyAt('10:00');
}
protected function commands()
{
$this->load(__DIR__.'/Commands');
require base_path('routes/console.php');
}
}
您的日程安排只有在您在 10:00 调用时才有效,
添加这个 cronjob
* * * * * php /path-to-your-project/artisan schedule:run >> /dev/null 2>&1
Laravel 每分钟都会调用这个函数,一旦到了 10:00,它就会相应地调用这个函数。 检查https://laravel.com/docs/5.5/scheduling#introduction ,搜索“启动调度程序”
在 AWS ECS 中,我们可以在不向容器中添加 cron 的情况下使用它
https://github.com/spatie/laravel-cronless-schedule
php artisan schedule:run-cronless
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.