scheduler.command() and scheduler.call()) inherit from the BaseSchedule class, which provides methods for configuring frequency, timing, and behavior.
Configuration Methods
timezone()
Set the timezone for the schedule.A valid timezone string (e.g.,
'America/New_York', 'UTC', 'Asia/Tokyo')tag()
Assign a tag to the schedule for grouping and filtering.The tag name to assign to this schedule
immediate()
Run the schedule immediately when the worker starts, in addition to the scheduled times.Whether to run immediately on start. Pass
false to disableskip()
Disable the schedule without removing it.Whether to skip this schedule. Pass
false to re-enablewithoutOverlapping()
Prevent the schedule from running if the previous execution is still in progress.Lock expiration time in milliseconds (default: 1 hour). After this time, the lock is released even if the task is still running
Lifecycle Methods
before()
Register a callback to run before the schedule executes.An async callback function to execute before the schedule runs
after()
Register a callback to run after the schedule executes.An async callback function to execute after the schedule completes
Frequency Methods - Every Second
everySecond()
Run the schedule every second.everySeconds()
Run the schedule every N seconds.Number of seconds between executions (1-59)
everyFiveSeconds()
Run the schedule every 5 seconds.everyTenSeconds()
Run the schedule every 10 seconds.everyFifteenSeconds()
Run the schedule every 15 seconds.everyThirtySeconds()
Run the schedule every 30 seconds.Frequency Methods - Every Minute
everyMinute()
Run the schedule every minute.everyMinutes()
Run the schedule every N minutes.Number of minutes between executions
everyTwoMinutes()
Run the schedule every 2 minutes.everyThreeMinutes()
Run the schedule every 3 minutes.everyFourMinutes()
Run the schedule every 4 minutes.everyFiveMinutes()
Run the schedule every 5 minutes.everyTenMinutes()
Run the schedule every 10 minutes.everyFifteenMinutes()
Run the schedule every 15 minutes.everyThirtyMinutes()
Run the schedule every 30 minutes.Frequency Methods - Hourly
hourly()
Run the schedule every hour at the start of the hour.hourlyAt()
Run the schedule every hour at a specific minute offset.The minute(s) of the hour to run (0-59). Can be a single value or an array for multiple times
everyHours()
Run the schedule every N hours with an optional minute offset.Number of hours between executions
The minute(s) of the hour to run
everyOddHour()
Run the schedule every odd hour (1, 3, 5, etc.).The minute(s) of the hour to run
everyTwoHours()
Run the schedule every 2 hours.everyThreeHours()
Run the schedule every 3 hours.everyFourHours()
Run the schedule every 4 hours.everyFiveHours()
Run the schedule every 5 hours.everySixHours()
Run the schedule every 6 hours.Frequency Methods - Daily
daily()
Run the schedule once a day at midnight.dailyAt()
Run the schedule once a day at a specific time.Time in 24-hour format (e.g.,
'14:30', '9:00')at()
Alias fordailyAt().
twiceDaily()
Run the schedule twice a day at specified hours.First hour of the day (0-23)
Second hour of the day (0-23)
twiceDailyAt()
Run the schedule twice a day at specified hours with a minute offset.First hour of the day (0-23)
Second hour of the day (0-23)
Minute offset (0-59)
Frequency Methods - Weekly
weekdays()
Run the schedule on weekdays (Monday through Friday).weekends()
Run the schedule on weekends (Saturday and Sunday).mondays()
Run the schedule on Mondays.tuesdays()
Run the schedule on Tuesdays.wednesdays()
Run the schedule on Wednesdays.thursdays()
Run the schedule on Thursdays.fridays()
Run the schedule on Fridays.saturdays()
Run the schedule on Saturdays.sundays()
Run the schedule on Sundays.days()
Run the schedule on specific days of the week.Day(s) of the week (0 = Sunday, 6 = Saturday). Can be a single day or an array
weekly()
Run the schedule once a week on Sunday at midnight.weeklyOn()
Run the schedule once a week on a specific day and time.Day of the week (0-7, where 0 and 7 are Sunday)
Time in 24-hour format
Frequency Methods - Monthly
monthly()
Run the schedule once a month on the first day at midnight.monthlyOn()
Run the schedule once a month on a specific day and time.Day of the month (1-31)
Time in 24-hour format
twiceMonthly()
Run the schedule twice a month on specific days.First day of the month (1-31)
Second day of the month (1-31)
Time in 24-hour format
lastDayOfMonth()
Run the schedule on the last day of every month.Time in 24-hour format
quarterly()
Run the schedule once every quarter (January, April, July, October) on the first day at midnight.yearly()
Run the schedule once a year on January 1st at midnight.yearlyOn()
Run the schedule once a year on a specific date and time.Month (1-12)
Day of the month (1-31)
Time in 24-hour format
Advanced Methods
cron()
Define a custom cron expression for the schedule.A cron expression with 6 fields:
seconds minutes hours dayOfMonth month dayOfWeekgetExpression()
Get the current cron expression for the schedule.Day Constants
You can use day constants for better readability when scheduling:SUNDAY = 0MONDAY = 1TUESDAY = 2WEDNESDAY = 3THURSDAY = 4FRIDAY = 5SATURDAY = 6