A cron expression builder can help you create a schedule quickly, but reliable automation requires more than choosing five fields. This guide explains standard cron syntax, provides reusable examples, and gives you a practical checklist for timezone behavior, permissions, logging, cloud differences, and troubleshooting jobs that run at the wrong time.
Overview
Cron is a scheduling system commonly used to run commands or scripts at recurring times. A cron expression describes when a job should run; the command or workflow describes what it should do. Keeping those two concerns separate makes schedules easier to review and repair.
Traditional Unix-style cron uses five fields in this order:
| Field | Allowed values | Meaning |
|---|---|---|
| Minute | 0–59 | Minute of the hour |
| Hour | 0–23 | Hour of the day in the scheduler's timezone |
| Day of month | 1–31 | Calendar day |
| Month | 1–12 | Month of the year |
| Day of week | 0–7 | Weekday; implementations commonly use both 0 and 7 for Sunday |
Symbols make expressions more flexible:
- * means every permitted value. In the minute field,
*means every minute. - , lists specific values, such as
1,15,30. - - defines a range, such as
9-17. - / defines an interval, such as
*/15for every 15 units within the field.
For example, 30 2 * * * means “run at 02:30 every day,” assuming a conventional five-field cron implementation. A schedule is not complete until you confirm the platform's field count, timezone, and special syntax. Some systems add a seconds field, while Quartz-style schedulers use a different format and may require a question mark in one of the calendar fields.
Checklist by scenario
Run once every day
Start with a fixed minute and hour, then use wildcards for the calendar fields:
15 1 * * *
This runs daily at 01:15 in the scheduler's local timezone. Choose a time when the system is unlikely to be under peak load, and make the command use an absolute path where possible.
Run every few minutes
*/10 * * * *
This expresses a ten-minute interval aligned to the clock: minute 0, 10, 20, 30, 40, and 50 of each hour. That is not always the same as “ten minutes after the previous run.” If the task can take longer than its interval, add a lock or another mechanism to prevent overlapping executions.
Run on weekdays during working hours
0 9-17 * * 1-5
This runs at the top of each hour from 09:00 through 17:00 on Monday through Friday in implementations that use 1–5 for weekdays. Verify the platform's weekday numbering before deploying it.
Run on selected days of the month
0 4 1,15 * *
This runs at 04:00 on the first and fifteenth day of each month. If your schedule combines both a day-of-month restriction and a day-of-week restriction, check the implementation's matching rules carefully. Traditional cron variants may treat those two fields differently from newer schedulers.
Build a schedule with a cron expression builder
- Write the requirement in plain language: “At 03:20 every Sunday.”
- Confirm whether the target accepts five fields, six fields, or a named scheduler format.
- Set the minute, hour, day-of-month, month, and day-of-week fields one at a time.
- Review the generated expression against at least two expected run times.
- Test the command independently before attaching it to the schedule.
- Record the expression, timezone, owner, purpose, and expected output in the job's documentation.
A generator is useful for reducing syntax errors, but it cannot determine whether the selected timezone, command path, permissions, or business deadline is correct. Treat the generated expression as a draft to validate, not as proof that the job will behave as intended.
What to double-check
Timezone and daylight-saving behavior
The same expression can produce different wall-clock times on machines configured for different timezones. A server may use UTC while an operator reads the schedule in local time. Write the timezone beside every production schedule, and convert one or two expected run times before deployment.
Daylight-saving transitions can create a local time that does not occur, or a local hour that occurs twice. Scheduler behavior varies: a job may be skipped, run once, or be evaluated according to the system's time rules. For deadlines tied to a business region, document the intended behavior and test the platform's guidance rather than assuming that a fixed local hour is unambiguous.
Command context
Cron often runs with a smaller environment than an interactive shell. Use absolute paths for executables and files, define required environment variables explicitly, and set a working directory when the application depends on relative paths. Confirm which user owns the entry and whether that account can read inputs, write outputs, and access required credentials.
Output, failures, and overlap
Decide where standard output and errors should go. A simple redirection can preserve evidence for troubleshooting:
0 3 * * * /opt/app/backup.sh >> /var/log/app-backup.log 2>&1
Use a log rotation strategy appropriate for the host. Also decide what should happen if one run is still active when the next trigger arrives. A lock, queue, or platform-level concurrency setting may be necessary for imports, backups, scrapers, and other jobs that can overlap.
Platform-specific syntax
Linux crontab, container schedulers, CI systems, cloud event rules, Kubernetes CronJobs, and application libraries may use similar-looking expressions with different limits or timezone controls. Check the target's documentation for supported ranges, missed-run behavior, minimum intervals, timeout handling, and whether the scheduler evaluates the expression in UTC or a configured zone.
Common mistakes
- Confusing “every N minutes” with “at a particular minute.”
*/15in the minute field runs at quarter-hour boundaries; it does not create a rolling 15-minute timer after each completion. - Using six-field syntax in a five-field scheduler. A leading seconds field can shift every value and produce an unexpected schedule.
- Forgetting that midnight is hour 0. Use
0 0 * * *for midnight in a conventional five-field expression, not hour 24. - Assuming the current shell environment is available. A command that works manually may fail because cron cannot find its executable, configuration file, or credentials.
- Ignoring the host's timezone. Always compare the scheduler's timezone with the timezone used in the requirement.
- Testing only the expression. A valid expression can still call the wrong script, run as the wrong user, or silently discard errors.
- Scheduling expensive work at the same time. Several valid jobs can compete for CPU, memory, database connections, or network bandwidth. Stagger related tasks when necessary.
- Failing to make jobs idempotent. Retries, duplicate triggers, or a manual rerun should not corrupt data or create duplicate records where avoidable.
When debugging, reduce the problem to three questions: did the scheduler trigger, did the command start, and did the command complete successfully? Check scheduler logs, process logs, exit codes, and file timestamps separately. If the command depends on JSON, SQL, regular expressions, or API authentication, validate those inputs independently with the appropriate developer tool before blaming the cron expression. Related workflows may benefit from a JSON validation workflow, an SQL formatter, or a JWT inspection guide.
When to revisit
Review a cron schedule before seasonal planning cycles, timezone changes, infrastructure migrations, and major application releases. A schedule should also be revisited when a server moves regions, a container image changes its entrypoint, credentials are rotated, a command path changes, or the job's runtime begins approaching its interval.
Use this short maintenance checklist:
- State the intended schedule in plain language.
- Confirm the expression format supported by the current platform.
- Record the timezone and inspect daylight-saving implications.
- Run the command manually as the same user and with the same environment.
- Check logs, exit codes, alerting, and retention.
- Look for overlapping runs and verify that retries are safe.
- Test the next expected execution in a non-production environment when possible.
- Update the documentation whenever the expression or command changes.
For a quick schedule, a cron expression builder can save time. For a dependable scheduled job, pair it with explicit timezone documentation, a tested command, observable logs, and a review date. That combination is what turns a correct-looking expression into maintainable automation.