Laravel Scheduler每天运行两次 [英] Laravel scheduler run twiceDaily at specific hours

查看:95
本文介绍了Laravel Scheduler每天运行两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在特定时间每天两次运行Laravel Scheduler?假设我希望我的命令每天在上午9点和下午5点运行

How can I run Laravel scheduler twice daily at specific hours? Let's say I want my command to run every day at 9am and 5pm

可以选择每天使用两次,但是我不确定如何指定小时数

There is an option to use twiceDaily, but I'm not sure how to specify hours

推荐答案

您可以使用手动cron表达式:

You can use manual cron expression:

$schedule->command('foo')->cron('0 9,17 * * *');

了解更多: http://laravel.com/docs/5.0/artisan #scheduling-artisan-commands

如果您不熟悉cron表达式,请使用以下漂亮的GUI: http://cron .nmonitoring.com/cron-generator.html

If you're not familiar with cron expressions, here's the nice GUI: http://cron.nmonitoring.com/cron-generator.html

这篇关于Laravel Scheduler每天运行两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆