Php 按laravel时间间隔安排作业
我在Kernel.php中每小时有三个计划作业,如下所示:Php 按laravel时间间隔安排作业,php,laravel,laravel-5,cron,scheduled-tasks,Php,Laravel,Laravel 5,Cron,Scheduled Tasks,我在Kernel.php中每小时有三个计划作业,如下所示: $schedule->command('get:twitter')->cron('* 1 * * * *'); $schedule->command('get:facebook')->cron('* 1 * * * *'); $schedule->command('get:googleplus')->cron('* 1 * * * *'); $schedule->command('get:tw
$schedule->command('get:twitter')->cron('* 1 * * * *');
$schedule->command('get:facebook')->cron('* 1 * * * *');
$schedule->command('get:googleplus')->cron('* 1 * * * *');
$schedule->command('get:twitter')->cron('* 1 * * * *');//after 1 hour
$schedule->command('get:facebook')->cron('30 1 * * * *');//after 1.30 hour
$schedule->command('get:googleplus')->cron('45 1 * * * *');//after 1.45 hour
我希望在某个时间间隔内运行这三个计划,如下所示:
$schedule->command('get:twitter')->cron('* 1 * * * *');
$schedule->command('get:facebook')->cron('* 1 * * * *');
$schedule->command('get:googleplus')->cron('* 1 * * * *');
$schedule->command('get:twitter')->cron('* 1 * * * *');//after 1 hour
$schedule->command('get:facebook')->cron('30 1 * * * *');//after 1.30 hour
$schedule->command('get:googleplus')->cron('45 1 * * * *');//after 1.45 hour
这在laravel 5.1中可能吗?没有现成的东西,但您可以这样做:
// every hour
$schedule->command('get:twitter')->hourly();
// every one and a half hours
$schedule->command('get:facebook')->cron('0 0,3,6,9,12,15,18,21 * * * *');
$schedule->command('get:facebook')->cron('30 1,4,7,10,13,16,19,22 * * * *');
// every two hours at x.15 minutes (0.15, 2.15, 4.15 etc)
$schedule->command('get:googleplus')->cron('15 */2 * * * *');
你需要每小时或每天运行一次吗?它们已经每小时运行一次了。。。但我想让时间间隔像这样:第一次计划每1小时跑一次,第二次计划每1.5小时跑一次,第三次计划每1.45小时跑一次……我想这里一切都会好的。您可以每1.45创建一个
,但这将是非常长且难看的代码。)好的,非常感谢。。现在我将把它添加到我的kernel.phphi中,我的客户机期望值是。每天晚上11点运行作业,但在星期天它应该每小时运行一次吗?我该怎么做?请帮忙