Laravel Homestead:设置 Cron 计划任务
Laravel 提供了一种 定时计划作业 的方式,只需每分钟运行一次 schedule:run
Artisan 命令即可。schedule:run
命令将检查在你在 App\Console\Kernel
类中定义的计划来决定运行哪个作业。
如果想要为某个 Homestead 站点运行 schedule:run
命令,需要在定义站点时设置 schedule
为 true
:
sites:
- map: homestead.test
to: /home/vagrant/project1/public
schedule: true
站点的 Cron 作业将被定义在虚拟机的 /etc/cron.d
目录中。
待测