W
W
WebDev2016-08-24 16:01:10
Laravel
WebDev, 2016-08-24 16:01:10

Laravel scheduler randomly starting?

$schedule->command('command:Command1')->cron('0 2,8,14,20 * * *');
        $schedule->command('command:Command2')->cron('0 2,8,14,20 * * *');
        $schedule->command('command:Command3')->cron('0 2,8,14,20 * * *');
        $schedule->command('command:Command4')->cron('0 2,8,14,20 * * *');
        $schedule->command('command:Command5')->cron('0 2,8,14,20 * * *');
        $schedule->command('command:Command6')->cron('0 2,8,14,20 * * *');

This is how I set the commands to run every 6 hours. I decided to check if the commands are running correctly. To do this, in each command I write to the log "Command #N started in dd-mm-yy H: i: s".
I check the log and see that the first command was launched at 14:00, as it should be, but the second command was launched THREE times for some reason:
[24-08-2016 14:50:37] - Command2 started
[24-08-2016 14:51:05] - Command2 started
[24-08-2016 14:51:42] - Command2 started

And a minute later launched the fourth. The fifth and sixth commands were not running at the time of checking the log.
All time zones in php and laravel settings are set correctly.
What's happening? The same commands through kroner were launched regularly.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Kolesnikov, 2016-08-26
@kolesnikov_i

Try this

$schedule->command('command:Command1')->cron('0 */6 * * *');

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question