Overview
Cron expressions define when recurring jobs should execute. Cuey uses the standard 5-field cron format.Cron Format
Cron expressions consist of 5 fields separated by spaces:Field Values
| Field | Values | Special Characters |
|---|---|---|
| Minute | 0-59 | * , - / |
| Hour | 0-23 | * , - / |
| Day of Month | 1-31 | * , - / |
| Month | 1-12 | * , - / |
| Day of Week | 0-6 (0=Sunday) | * , - / |
Special Characters
*- Matches any value,- Value list separator (e.g.,1,3,5)-- Range (e.g.,1-5)/- Step values (e.g.,*/15)
Common Examples
Every Minute
Every Hour
Every Day at Midnight
Every Day at 9 AM
Every Monday at 9 AM
Every Weekday at 9 AM
Every 15 Minutes
Every 30 Minutes
Every Hour on the Hour
First Day of Every Month at Midnight
Every Monday, Wednesday, Friday at 9 AM
Every Day at 9 AM and 5 PM
Timezone Support
Cron expressions can be combined with timezones to schedule jobs in specific time zones. When creating a cron job, you can specify a timezone (e.g.,America/New_York, Europe/London). If no timezone is specified, UTC is used.
Example: Daily Report in Different Timezones
- Daily report at 9 AM EST:
0 9 * * *with timezoneAmerica/New_York - Daily report at 9 AM PST:
0 9 * * *with timezoneAmerica/Los_Angeles - Daily report at 9 AM UTC:
0 9 * * *with no timezone (defaults to UTC)
Advanced Patterns
Every 5 Minutes During Business Hours (9 AM - 5 PM, Weekdays)
Every Hour During Night Hours (10 PM - 6 AM)
Twice Daily (9 AM and 6 PM)
Every 10 Minutes on Weekdays
First Monday of Every Month
This requires more complex logic - consider using scheduled events instead of cron jobs for this pattern.Best Practices
Use Specific Times
- ✅ Good:
0 9 * * *- Specific time (9 AM sharp) - ❌ Avoid:
* * * * *- Every minute (unless necessary)
Consider Timezones
- ✅ Good: Specify timezone for user-facing schedules (e.g.,
America/New_Yorkfor business hours) - ✅ Good: Use UTC for system-level jobs (omit timezone or set to
null)
Document Complex Expressions
When using complex cron expressions, document what they represent in comments or descriptions:0 9 * * 1-5- Weekdays at 9 AM*/5 9-17 * * 1-5- Every 5 minutes during business hours (9 AM - 5 PM, weekdays)
Common Use Cases
Health Checks
Daily Reports
Weekly Summaries
Monthly Tasks
Testing Cron Expressions
You can test cron expressions using online tools or validate them when creating cron jobs. Invalid cron expressions will be rejected with a validation error.Related Resources
Building Blocks
Understand events and crons.
TypeScript SDK
Get started with the TypeScript SDK.
REST API
Explore the REST API documentation.