Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

giwrgos's avatar

Task scheduling runs every minute instead of the time that I set

Hello,

I'm working a task scheduler on homestead on my local environment. I've set the following cron job

05 00 * * * php  /home/vagrant/Projects/Laravel/Game/artisan schedule:run

which basically needs to run once a day every midnight at 00:05, but instead it runs every minute. Can anyone tell me what I'm doing wrong?

Thanks

0 likes
5 replies
Cronix's avatar

homestead already has a cron job running every minute, which executes schedule:run (which is how it is supposed to be). You shouldn't have to enter anything in cron.

You just need to schedule a job through the scheduler using ->dailyAt('00:05'); if you want it to run at 5 after midnight.

https://laravel.com/docs/5.5/scheduling

giwrgos's avatar

@Cronix is there a way to disable it? I have a console kernel class that creates random hours for the scheduler as cron

                foreach ($times as $time) {
                    $time = Carbon::createFromTimestamp($time);
                    $cron = $time->minute. ' '. $time->hour . ' ' . $time->day .' ' . $time->month .' * ';
                    $schedule->command('client:submit-details')->cron($cron);
                }
Cronix's avatar

I guess remove the default cron job that's running every minute. But then you'd lose the whole purpose of having cron jobs in code as opposed to crontab and would have to create and maintain each cronjob on each server manually. It's much better to have it in code so it's a part of your repo, and you only ever need one actual cron job to execute all jobs no matter when they were.

Cronix's avatar

You could also check the current date/time to see if it matches your $time in your loop, and execute the scheduled command if it is. That would allow you to keep everything in code still and do what you are wanting.

giwrgos's avatar

@Cronix i know but for now i have to disable them. do you know how i can do it?

Please or to participate in this conversation.