Cron expressions
For maximum flexibility, use thecron() method to specify a custom cron expression:
Minute-based frequencies
Schedule tasks to run at minute intervals:everyMinutes() method with a custom interval:
Second-based frequencies
For more frequent execution, schedule tasks at second intervals:everySeconds() method for custom intervals:
Hourly frequencies
Schedule tasks to run every hour or at specific intervals:Running at specific minutes
UsehourlyAt() to run a task every hour at a specific minute:
Odd hours
Schedule tasks to run during odd hours:Daily frequencies
Schedule tasks to run daily:Weekdays and weekends
Restrict tasks to weekdays or weekends:Specific days
Schedule tasks to run on specific days of the week:Weekly frequencies
Schedule tasks to run weekly:weeklyOn() method accepts a day of the week (0 = Sunday, 6 = Saturday) and an optional time.
Monthly frequencies
Schedule tasks to run monthly:Quarterly and yearly frequencies
Schedule tasks to run quarterly or yearly:Timezone configuration
By default, scheduled tasks run in your server’s timezone. Use thetimezone() method to specify a different timezone:
Frequency reference
| Method | Description |
|---|---|
.cron('* * * * *') | Run on a custom cron schedule |
.everySecond() | Run every second |
.everySeconds(n) | Run every n seconds |
.everyFiveSeconds() | Run every five seconds |
.everyTenSeconds() | Run every ten seconds |
.everyFifteenSeconds() | Run every fifteen seconds |
.everyThirtySeconds() | Run every thirty seconds |
.everyMinute() | Run every minute |
.everyMinutes(n) | Run every n minutes |
.everyTwoMinutes() | Run every two minutes |
.everyThreeMinutes() | Run every three minutes |
.everyFourMinutes() | Run every four minutes |
.everyFiveMinutes() | Run every five minutes |
.everyTenMinutes() | Run every ten minutes |
.everyFifteenMinutes() | Run every fifteen minutes |
.everyThirtyMinutes() | Run every thirty minutes |
.hourly() | Run every hour |
.hourlyAt(17) | Run every hour at 17 minutes past |
.everyHours(n) | Run every n hours |
.everyOddHour() | Run every odd hour |
.everyTwoHours() | Run every two hours |
.everyThreeHours() | Run every three hours |
.everyFourHours() | Run every four hours |
.everyFiveHours() | Run every five hours |
.everySixHours() | Run every six hours |
.daily() | Run every day at midnight |
.dailyAt('13:00') | Run every day at 13:00 |
.twiceDaily(1, 13) | Run daily at 1:00 and 13:00 |
.twiceDailyAt(1, 13, 15) | Run daily at 1:15 and 13:15 |
.weekdays() | Constrain to weekdays |
.weekends() | Constrain to weekends |
.mondays() | Constrain to Mondays |
.tuesdays() | Constrain to Tuesdays |
.wednesdays() | Constrain to Wednesdays |
.thursdays() | Constrain to Thursdays |
.fridays() | Constrain to Fridays |
.saturdays() | Constrain to Saturdays |
.sundays() | Constrain to Sundays |
.weekly() | Run every Sunday at 00:00 |
.weeklyOn(1, '8:00') | Run every week on Monday at 8:00 |
.monthly() | Run on the first day of every month at 00:00 |
.monthlyOn(4, '15:00') | Run every month on the 4th at 15:00 |
.twiceMonthly(1, 16, '13:00') | Run monthly on the 1st and 16th at 13:00 |
.lastDayOfMonth('15:00') | Run on the last day of the month at 15:00 |
.quarterly() | Run on the first day of every quarter at 00:00 |
.quarterlyOn(4, '14:00') | Run every quarter on the 4th at 14:00 |
.yearly() | Run on the first day of every year at 00:00 |
.yearlyOn(6, 1, '17:00') | Run every year on June 1st at 17:00 |
.timezone('America/New_York') | Set the timezone for the task |