A cron expression is small, but a mistake can create missed jobs, duplicate runs, or unexpected load. This guide explains cron syntax, provides reusable schedule examples, and gives you a verification and deployment checklist for Linux, Kubernetes, CI platforms, and cloud schedulers.
Overview
Cron is a scheduling format used to describe recurring times. A traditional Unix-style cron expression has five fields, read from left to right: minute, hour, day of month, month, and day of week.
| Field | Allowed values in common five-field cron | Example meaning |
|---|---|---|
| Minute | 0–59 | 15 means at minute 15 |
| Hour | 0–23 | 8 means at 08:00 |
| Day of month | 1–31 | 1 means the first day |
| Month | 1–12, or names in some implementations | 6 means June |
| Day of week | 0–7, with conventions varying | 1 commonly means Monday |
The asterisk means “any permitted value.” A comma lists separate values, a hyphen defines a range, and a slash creates a step. For example, 0,30 means two specific values, 1-5 means a range, and */15 means every 15 units within the field.
Start by describing the schedule in plain language. “At 02:30 every day in the application’s business timezone” is easier to verify than trying to guess the expression immediately. Then write the expression, test it with a cron expression tester or cron expression builder, and confirm the result against the scheduler that will actually run it.
Checklist by scenario
Every minute, hour, or fixed interval
* * * * *— every minute.0 * * * *— at the start of every hour.*/15 * * * *— every 15 minutes.0 */6 * * *— every six hours, at minute zero.
Use interval schedules carefully for jobs that may take longer than the interval. Confirm whether the scheduler prevents overlapping runs. If it does not, add a lock, concurrency policy, or queue-based design so a slow execution cannot create a growing set of concurrent jobs.
Daily schedules
30 2 * * *— every day at 02:30.0 8 * * 1-5— weekdays at 08:00.0 0 * * 0— Sundays at midnight under implementations where zero represents Sunday.
Midnight is a useful boundary for reports and cleanup, but it is also a common period for maintenance and backups. Check the surrounding workload before choosing it. If a job is operationally important, document whether “daily” means calendar-day execution or 24 hours after the previous run.
Weekly schedules
0 9 * * 1— Mondays at 09:00.0 18 * * 5— Fridays at 18:00.
Day-of-week numbering is not fully consistent across all cron implementations. Some accept both 0 and 7 for Sunday; others support names. Prefer the target platform’s documented form and test the expression there rather than relying on a generic online result.
Monthly and quarterly schedules
0 4 1 * *— the first day of every month at 04:00.0 3 15 1,4,7,10 *— the 15th day of each quarter’s first month.
Cron does not provide a universal “last day of the month” syntax. A schedule such as day 31 will not run in shorter months, and special extensions differ between implementations. For month-end work, schedule a daily check near the end of the month and let the application determine whether the intended date has arrived, or use a scheduler feature designed for calendar rules.
Kubernetes CronJob schedules
A Kubernetes CronJob commonly uses a five-field cron schedule in its spec.schedule value:
apiVersion: batch/v1
kind: CronJob
metadata:
name: nightly-report
spec:
schedule: "30 2 * * *"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: report
image: example/report:stableThe schedule is only one part of a safe Kubernetes CronJob. Review the concurrency policy, failed-job retention, restart behavior, resource limits, image version, permissions, and observability. Confirm the Kubernetes version and cluster configuration before using timezone-related fields or features; platform support can vary. This is especially important during cluster upgrades, alongside the checks in the Kubernetes upgrade checklist.
CI and cloud schedulers
CI/CD systems and cloud platforms may accept a familiar five-field expression but apply their own timezone, minimum interval, missed-run, or delivery rules. Some use a six-field format that includes seconds; Quartz-style schedulers may use six or seven fields and a different day-of-week convention. Read the platform’s syntax reference, identify the default timezone, and test the expression in the actual project or account whenever possible.
What to double-check
Timezone and daylight-saving changes
A schedule without an explicit timezone is easy to misunderstand. It may use the host, container, cluster, account, or platform default. Record the intended IANA timezone, such as Europe/London or America/New_York, where the scheduler supports it. If the platform only schedules in UTC, convert the business requirement to UTC and document that conversion.
Daylight-saving transitions can create a local time that occurs twice or does not occur at all. Decide whether the job should run once, twice, or be skipped in that situation. For billing, compliance, and customer notifications, an application-level calendar rule may be safer than a basic cron expression.
Day-of-month and day-of-week behavior
When both the day-of-month and day-of-week fields contain specific values, implementations may treat them as an OR condition rather than requiring both to match. This can produce more runs than expected. Test a schedule such as 0 9 1 * 1 explicitly, especially if it is intended to mean “the first day of the month when it is Monday” rather than “the first day or every Monday.”
Execution, retries, and failure handling
A cron entry only describes when to start work. It does not automatically define retries, alerting, idempotency, timeouts, or ownership. Before deployment, answer these questions:
- Who owns the job and receives failures?
- What is the expected duration and maximum runtime?
- Can a retry safely repeat the operation?
- What happens if the destination is unavailable?
- Where are logs, metrics, and execution history stored?
- How is a missed or duplicated run detected?
For delivery workflows, connect scheduled automation to a documented release and incident process. The guidance in release management tools compared can help place scheduled jobs within a broader release-control workflow.
Deployment handoff template
Put the following information next to the expression in the repository, runbook, or internal developer portal:
Job name:
Purpose:
Owner and backup:
Scheduler and version:
Expression:
Timezone:
Expected run window:
Timeout and concurrency behavior:
Retry policy:
Failure alert destination:
Logs and dashboard:
Permissions and secrets:
Safe manual-run procedure:
Rollback or disable procedure:
Last verification date:Common mistakes
- Confusing fields:
0 2 * * *means 02:00, not two minutes after every hour. - Using six fields in a five-field scheduler: An expression copied from a seconds-aware tool may be rejected or interpreted incorrectly.
- Assuming local time: Containers, CI runners, and cloud services may use UTC or another configured timezone.
- Ignoring overlaps: A recurring job can start again before the prior execution ends.
- Relying on an online tester alone: A generic tester may use different day-of-week rules, timezone assumptions, or extensions.
- Scheduling destructive work without a guard: Add environment checks, dry-run support, and an explicit production safeguard where appropriate.
- Leaving ownership implicit: A job without a named owner is difficult to repair when a team or platform changes.
- Testing only the expression: Also test credentials, permissions, network access, output destinations, and alert delivery.
When to revisit
Review a cron expression before seasonal planning cycles, timezone changes, major maintenance windows, and any migration between hosts, CI/CD tools, Kubernetes clusters, or cloud schedulers. Recheck it when a workflow changes, a job’s runtime grows, ownership moves, or the business definition of “daily,” “weekly,” or “month-end” changes.
As a practical final check, write the next three expected run times in the job’s documented timezone. Compare them with a trusted cron expression tester and the target platform’s own behavior. Deploy first in a non-production environment when possible, observe at least one successful run and one failure path, then record the verification date and owner. Repeat this checklist after platform upgrades or scheduler changes rather than assuming a previously valid expression remains portable.