A reliable cron schedule starts with more than a valid-looking expression. This guide explains each field, provides reusable cron schedule examples, compares common cron formats, and gives you a practical checklist for avoiding missed, duplicated, or time-shifted jobs.
Overview
Cron is a scheduler commonly used to run commands or scripts at recurring times. It is useful for database backups, report generation, log cleanup, certificate checks, deployment tasks, and routine maintenance. A cron expression describes when a job may run; the command that follows describes what it should run.
In traditional Unix-style cron, the schedule usually contains five time fields:
| Field | Allowed values | Meaning |
|---|---|---|
| Minute | 0–59 | Minute within the hour |
| Hour | 0–23 | Hour in 24-hour time |
| Day of month | 1–31 | Calendar day |
| Month | 1–12 | Calendar month |
| Day of week | 0–7 | Weekday; 0 and 7 commonly represent Sunday |
The fields are separated by spaces. For example, 30 2 * * * means “at 02:30 every day” under a five-field cron format. The asterisk means every permitted value. A schedule is not complete until you also confirm the scheduler’s time zone, execution environment, permissions, and failure-handling behavior.
Before installing a schedule, use a cron expression builder or another trusted validator to check the expression, then compare its next several run times with your intended calendar. A parser can confirm syntax, but only a human review can confirm that “the first business day” or “every weekday” was expressed correctly for your platform.
Checklist by scenario
Every few minutes or at a fixed interval
Use a step expression when the interval divides the field’s range in a way your scheduler supports:
*/5 * * * *— every five minutes.*/15 * * * *— every fifteen minutes.0 */2 * * *— at minute zero every two hours.
Check whether “every five minutes” means from the start of each hour or every five minutes after a job finishes. Standard cron uses wall-clock times, so a long-running command may overlap with its next scheduled start unless you add locking or another concurrency control.
Daily jobs
0 6 * * *— every day at 06:00.30 23 * * *— every day at 23:30.0 0 * * *— at midnight, subject to the scheduler’s time zone.
Prefer a documented, unambiguous time zone over relying on the host’s default. A schedule that runs at midnight on a developer laptop may run at a different local time after deployment to a server or container.
Weekday and weekend schedules
0 9 * * 1-5— at 09:00 Monday through Friday in implementations using 1–5 for weekdays.0 10 * * 6,0— at 10:00 on Saturday and Sunday in implementations where Sunday is 0.
Confirm weekday numbering before copying an expression between systems. Some tools accept names such as MON-FRI, while others accept only numbers or interpret numbers differently.
Monthly schedules
0 1 1 * *— at 01:00 on the first day of each month.0 3 15 * *— at 03:00 on the fifteenth day of each month.
A schedule for the “last day of the month” is not portable across basic cron implementations because months have different lengths. If you need that behavior, use a supported platform feature, run on a safe day and verify the date in the command, or move the calendar logic into a script.
Backups, reports, and maintenance
For an operational job, the expression is only one part of the checklist:
- Choose a low-conflict time based on expected traffic and other scheduled work.
- Use absolute paths for the executable, files, and configuration where practical.
- Send standard output and errors to a deliberate destination, or capture them in the platform’s logs.
- Make the command safe to retry if a network request or process interruption occurs.
- Add a lock, queue, or equivalent guard when overlapping runs could corrupt data or duplicate work.
- Test the command manually as the same user that will run it.
Jobs that call webhooks or external APIs should also account for retries and duplicate delivery. The Webhook Testing and Debugging Guide provides a related checklist for verifying signatures, retries, and duplicate events.
Hosted schedulers and application platforms
Do not assume a hosted cron expression builder uses the same format as Linux crontab. Common variations include:
- A required seconds field, producing six fields instead of five.
- A required year field, producing six or seven fields.
- A username field in a system crontab, such as
/etc/crontab. - Special tokens such as
?,L,W, or#. - A scheduler-specific time-zone setting or a fixed UTC default.
Read the target platform’s expression reference before deployment. A valid expression in one scheduler may be rejected, interpreted differently, or silently normalized by another.
What to double-check
Field order and punctuation
Read an expression from left to right and label every field before changing it. A comma creates a list, a hyphen creates a range, and a slash creates a step. For example, 0 8,12,16 * * * runs at 08:00, 12:00, and 16:00 each day, while 0 8-16/2 * * * runs every two hours from 08:00 through 16:00. Spaces separate fields; adding or removing one can change the entire format.
Day-of-month and day-of-week behavior
The interaction between the day-of-month and day-of-week fields is a frequent source of surprises. In many traditional cron implementations, when both fields contain restrictions rather than asterisks, a job runs when either restriction matches. Other schedulers may use different rules or provide a special syntax for expressing an AND relationship. Test expressions such as “the first Monday” with the target parser rather than relying on memory.
Time zones and daylight-saving changes
Record the intended time zone next to every business-critical schedule. Then ask what happens when clocks move forward or backward. During a clock change, a local time may not occur, may occur twice, or may be handled according to a scheduler-specific policy. A job scheduled at a sensitive local time can therefore be skipped or run twice.
For jobs that must run at a consistent interval or a globally coordinated moment, UTC may be simpler. For jobs tied to a local business day, use the required local zone and explicitly document the expected daylight-saving behavior. Never infer the scheduler’s time zone from the server’s location alone.
Environment and permissions
Cron often runs with a smaller environment than an interactive shell. Verify the executable path, working directory, environment variables, credentials, file permissions, network access, and shell assumptions. A command that works in a terminal may fail under cron because a runtime manager, alias, profile file, or relative path is unavailable.
Common mistakes
- Using six fields in a five-field scheduler. Determine whether the first field is minutes or seconds before pasting an expression.
- Assuming asterisk means “when needed.” An asterisk means every permitted value in that field, so
* * * * *requests a run every minute. - Confusing interval and calendar schedules. Cron describes clock times. It does not inherently mean “five minutes after the previous run finishes.”
- Forgetting the command’s exit status. A process can start successfully and still fail later. Log output and monitor the result for important jobs.
- Ignoring overlapping executions. A slow backup or API task can still be running when the next invocation starts.
- Testing only the expression. Validate the complete command as the scheduled user, including paths, credentials, and output handling.
- Relying on an undocumented default time zone. Make the time zone visible in configuration, comments, or deployment documentation.
- Calling a date assumption portable. “Last day,” “business day,” and “first Monday” often require platform-specific syntax or script logic.
When troubleshooting a missed job, first confirm that the scheduler loaded the current entry. Next inspect the scheduler’s logs, then run the command manually with the same user and environment. Finally, compare the recorded timestamp with the scheduler’s actual time zone and daylight-saving rules. This sequence separates syntax errors from application failures and clock-related behavior.
When to revisit
Recheck a cron schedule whenever the workflow, platform, or calendar assumptions change. A useful maintenance checklist is:
- Before seasonal planning cycles: review local-time schedules before daylight-saving transitions, fiscal reporting periods, or planned holiday closures.
- When workflows change: confirm that renamed scripts, moved files, changed credentials, and new runtime versions still match the cron command.
- When tools change: reread the hosted scheduler or operating-system documentation after migrating platforms, containers, orchestration systems, or CI providers.
- After an incident: record the expression, effective time zone, actual run times, exit status, and overlap behavior so the fix is reproducible.
- Periodically for critical jobs: review logs, alerting, retention, permissions, and retry behavior—not just whether the expression parses.
Before approving a new schedule, complete this final pass: write the intended behavior in plain language, identify the exact cron dialect, label each field, calculate several upcoming run times, confirm the time zone, test the command as its real execution user, and decide how failures and duplicate runs will be handled. That checklist is short enough to use every time and detailed enough to catch the mistakes that a syntax-only cron expression builder cannot.