阅读(1913) (0)

Laravel 8 配置 Cron 定时计划

2021-06-22 14:02:08 更新

Laravel 提供了一种很方便的设置 定时计划作业 的方式,只需每分钟运行一次 schedule:run Artisan 命令。scheduler:run 命令将根据您在 App\Console\Kernel 类中定义的计划来决定运行哪个作业。

如果您想要在 Homestead 站点中运行 schedule:run 命令,可在定义站点时将 schedule 选项置为 true

sites:
    - map: homestead.test
      to: /home/vagrant/project1/public
      schedule: true 

站点的 Cron 作业定义在虚拟机中的 /etc/cron.d 目录中。