Reputation: 484
I have three schedule job every hour in Kernel.php like below:
$schedule->command('get:twitter')->cron('* 1 * * * *');
$schedule->command('get:facebook')->cron('* 1 * * * *');
$schedule->command('get:googleplus')->cron('* 1 * * * *');
I want to run this three schedule in some time interval like below:
$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
Is this possible in laravel 5.1
Upvotes: 4
Views: 4648
Reputation: 316
With recent Laravel updates, you can run it as below:
// Run the task every hour at 17 minutes past the hour
$schedule->command('emails:send')->hourly(17);
https://laravel.com/docs/8.x/scheduling#schedule-frequency-options
Upvotes: 0
Reputation: 163968
There is no anything out of box but you can do something like this:
// 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 * * * *');
Upvotes: 5