Laravel Scheduler Adds Support for Running Hourly Tasks on a Certain Minute
Published on by Eric L. Barnes
The Laravel Scheduler now includes a new method hourlyAt
that will allow you to define the minute within the hour that it should run. This helpful in situations where you have a task that should run hourly but not at the top of the hour.
Using the same simple syntax as all the other methods and here is a quick example:
$schedule->command('mytask')->hourlyAt(15);
This will set the command to run every hour on the 15th minute. Of course, you can still pair it with the other methods to get more fine-grained control:
$schedule->command('mytask') ->weekdays() ->hourlyAt(15);
This feature is included starting at v5.3.29 and will allow you to use the familiar syntax instead of having to jump into using the cron
method to define it.
Eric is the creator of Laravel News and has been covering Laravel since 2012.