cron buildercron expressionscheduled jobscron syntaxtask scheduler

How to Build Cron Expressions for Scheduled Jobs

Scheduled jobs power everything from database backups to daily reports. Learn how to construct valid cron expressions for any schedule and test them before deploying.

8 min read

Related Tool

Cron Expression Builder

Open tool

Cron is the most widely used mechanism for running scheduled tasks on Unix and Linux systems. A cron expression defines when a job should run: every minute, every day at midnight, every weekday at 9 AM, every first of the month, and many more patterns. Writing cron expressions correctly and verifying them before deployment prevents silent failures and unexpected scheduling bugs.

The Five-Field Cron Format

A standard cron expression has five fields separated by spaces. From left to right: minute (0 to 59), hour (0 to 23), day of month (1 to 31), month (1 to 12), and day of week (0 to 7, where 0 and 7 both represent Sunday).

An asterisk in any field means every valid value for that field. The expression * * * * * runs every minute. The expression 0 * * * * runs at the start of every hour (minute 0 of every hour of every day).

Common Schedule Patterns

Every day at midnight: 0 0 * * *

Every weekday at 9 AM: 0 9 * * 1-5

Every Monday at 8:30 AM: 30 8 * * 1

Every 15 minutes: */15 * * * *

The first of every month at 3 AM: 0 3 1 * *

Every Sunday at 10 PM: 0 22 * * 0

Platform-Specific Differences

Standard cron (as in /etc/crontab) uses the five-field format. Some platforms extend this:

AWS EventBridge cron uses a six-field format with a year field and has a slightly different day-of-week range.

GitHub Actions uses the same five-field UTC cron for workflow schedules.

Kubernetes CronJob uses the standard five-field format. Quartz scheduler (Java) uses a six-field or seven-field format that is more expressive but not compatible with standard cron.

Always check the platform documentation for the exact format expected.

Using the DevHexLab Cron Builder

Open the tool at /tools/network/cron-builder. Use the controls to set the schedule visually. The plain-English description updates as you adjust the fields, confirming the schedule means what you intend. The next several run times are shown so you can verify the behavior before deploying.

Frequently Asked Questions

What time zone does cron use?

Standard cron uses the server's local time zone. Cloud-based schedulers (GitHub Actions, AWS EventBridge) use UTC by default. Be explicit about time zones in your documentation.

Can I run a job every 5 minutes starting from minute 2?

Yes. Use the step syntax: 2/5 * * * * runs at minutes 2, 7, 12, 17, 22, 27, 32, 37, 42, 47, 52, and 57.

What if two jobs are scheduled at the same time?

They run in parallel (or queue, depending on the system). Cron does not prevent concurrent execution of the same job; implement your own locking if needed.

Build the expression, verify the schedule, deploy with confidence.