繁体   English   中英

Laravel 8 通过 AWS EC2 上的 cron 计划 linux - 命令未运行

[英]Laravel 8 schedule via cron on AWS EC2 linux - commands not running

我在 AWS EC2 中创建了一个 cron 作业,但它没有在预定时间运行。当我在 cli php artisan schedule:run 中运行命令时,它工作正常但没有在预定时间自动执行。

php 版本=7.4.3

php 框架 = 8

我使用 crontab -e 在 crontab 中添加了 cron 条目

* * * * * cd /var/www/html/artisan schedule:run >> /dev/null 2>&1

在此处输入图像描述

/var/www/html/app/Console\Kernal

  /**
     * Define the application's command schedule.
     *
     * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
     * @return void
     */
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('booking:cron')->everyMinute();

    }

       /**
         * The Artisan commands provided by your application.
         *
         * @var array
         */
        protected $commands=[
            '\App\Console\Commands\BookingCron',
        ];

你的 cron 命令中有一个不需要的cd ,它应该是

* * * * * /var/www/html/artisan schedule:run >> /dev/null 2>&1

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM