Reading the five fields
┌───────────── minute (0 – 59)
│ ┌─────────── hour (0 – 23)
│ │ ┌───────── day of month (1 – 31)
│ │ │ ┌─────── month (1 – 12 or JAN – DEC)
│ │ │ │ ┌───── day of week (0 – 6, Sunday = 0, or SUN – SAT)
│ │ │ │ │
30 3 * * 1-5 → 03:30, Monday to Friday
| Operator | Meaning | Example |
|---|---|---|
* | Every value | * * * * *: every minute |
, | A list | 0 6,18 * * *: 06:00 and 18:00 |
- | A range | 0 9-17 * * *: hourly from 09:00 through 17:00 |
/ | A step | */15 * * * *: every 15 minutes |
L | Last (extension) | 0 0 L * *: last day of the month; not supported by standard cron |
Step values start at the field boundary
*/20 * * * * runs at :00, :20 and :40 because the step starts at zero in the minute field. It does not start when the job is installed. Likewise, */45 runs at :00 and :45, followed by :00 in the next hour, so one interval is only 15 minutes.
For an even interval that does not divide the hour, run more frequently and check elapsed time inside the job, or use an interval-based scheduler such as a systemd timer.
Which timezone does cron use?
A system crontab uses the server’s configured timezone, which is often UTC on cloud instances. Confirm that timezone before translating a local business time into a cron expression.
- Set the timezone explicitly. Vixie cron supports
CRON_TZ=Europe/Londonat the top of a crontab, while some other implementations useTZ=. - Kubernetes CronJobs: Kubernetes v1.27 and later support
.spec.timeZone. Without it, scheduling follows the controller manager’s timezone. - Account for daylight-saving changes. Depending on the cron implementation, a time in the transition window may be skipped or repeated. Use UTC or choose a time outside the local transition window for jobs that must run once.
Six-field scheduler formats
Quartz and Spring’s @Scheduled syntax use six fields by adding seconds at the front. AWS EventBridge also uses six fields, but its final field is a year, and one of its day fields uses ? instead of *.
Standard (5) 30 3 * * 1-5 03:30 on weekdays
Quartz (6) 0 30 3 ? * MON-FRI leading seconds, ? for unused day field
EventBridge 30 3 ? * MON-FRI * trailing year
A valid expression for one scheduler may be invalid or mean something different in another. This tool validates the standard five-field format only.
Making cron failures visible
# Open the current user crontab
crontab -e
# Display the current crontab
crontab -l
# Send output to a log because cron mail is often unread
# This keeps failures visible
30 3 * * 1-5 /usr/local/bin/backup.sh >> /var/log/backup.log 2>&1
# Escape percent signs in crontab commands
0 4 * * * /usr/bin/pg_dump db > /backups/db-$(date +\%Y\%m\%d).sql
- Use absolute paths. Cron often has a minimal
PATH, such as/usr/bin:/bin. Use full paths for commands that may not be available there. - Load required environment explicitly. Do not assume cron reads
.bashrc,.profile,nvmconfiguration or a virtual environment. - Escape
%. A percent sign represents a newline in a crontab. An unescapeddate +%Ycan truncate the command. - End the file with a newline. Some cron implementations ignore a final crontab line that has no newline.
- Prevent overlapping runs. If a job can exceed its interval, a lock such as
flock -n /tmp/job.lockcan stop another copy from starting.
Frequently asked questions
What does 30 3 1-5 mean?
It runs at 03:30 every Monday through Friday in every month. 30 is the minute, 3 is the hour and 1-5 covers Monday through Friday in the day-of-week field.
Why has my cron job never run?
Check whether the command uses an unavailable relative path, the script is executable, the crontab ends with a newline, the server timezone matches the schedule and each % is escaped. Redirect standard output and standard error to a log while diagnosing the failure.
How do I run something every 30 seconds?
Standard cron has one-minute granularity. You can run once per minute and perform a second pass after a 30-second delay, or use a scheduler such as systemd timers that supports sub-minute intervals.
Is 0 the same as 7 for Sunday?
Many cron implementations accept both values for Sunday, but support for 7 is not universal. This tool accepts day-of-week values from 0 through 6, with 0 for Sunday.
What happens to a job scheduled during a daylight-saving change?
Behavior varies by implementation. Vixie cron may compensate for a skipped spring-forward time and suppress a repeated autumn run, but other schedulers differ. For important jobs, use UTC or avoid the local transition window.