Cron is the classic way to run jobs on a schedule – backups every night, reports every Monday, cleanup every 15 minutes. A cron expression like 30 2 * * 1-5 packs a schedule into five fields. Once you know what each field means, you can read and write them in seconds.
Page Contents
The five fields
| Position | Field | Allowed values |
|---|---|---|
| 1 | Minute | 0–59 |
| 2 | Hour | 0–23 |
| 3 | Day of month | 1–31 |
| 4 | Month | 1–12 or JAN–DEC |
| 5 | Day of week | 0–6 (0 = Sunday) or SUN–SAT |
Special characters
*– every value (“every minute”, “every hour”),– a list:1,15= the 1st and 15th-– a range:1-5= Monday to Friday/– a step:*/15in the minute field = every 15 minutes
Examples
| Expression | Runs |
|---|---|
* * * * * | Every minute |
*/5 * * * * | Every 5 minutes |
0 * * * * | Every hour, on the hour |
0 */6 * * * | Every 6 hours |
0 0 * * * | Every day at midnight |
30 2 * * * | Every day at 02:30 |
0 9 * * 1-5 | Weekdays at 09:00 |
0 9 * * 1 | Every Monday at 09:00 |
0 0 * * 0 | Every Sunday at midnight |
0 0 1 * * | First day of every month |
0 0 1 1 * | Every year on 1 January |
15 14 1,15 * * | 14:15 on the 1st and 15th |
0 22 * * 1-5 | Weeknights at 22:00 |
0 8-18 * * 1-5 | Every hour from 08:00 to 18:00 on weekdays |
0 0 * * 6,0 | Weekends at midnight |
Time zones
- Linux crontab: uses the server’s time zone.
- GitHub Actions: schedules run in UTC, and very frequent schedules may be delayed at busy times. The shortest interval is every 5 minutes.
- Kubernetes CronJob: uses the controller’s time zone unless you set the
timeZonefield. - Cloud schedulers: usually let you choose a time zone.
Always check which time zone your platform uses – it is the most common reason a job runs “at the wrong time”. Convert times with the Unix Timestamp Converter.
Common mistakes
- Every minute by accident:
* 9 * * *runs every minute from 09:00 to 09:59. You probably meant0 9 * * *. - Day of month and day of week together: in standard cron,
0 0 13 * 5runs on the 13th or on every Friday – not only on Friday the 13th. - Seconds field: some systems (Quartz, Spring) use six or seven fields with seconds first. Standard cron has five.
- Overlapping runs: if a job takes longer than its interval, two copies may run at once. Use a lock.
- Silent failures: log output and alert on errors.
FAQ
What does * * * * * mean in cron?
Run every minute.
How do I run a cron job every 5 minutes?
Use */5 * * * *.
What time zone does cron use?
The server’s time zone for crontab; UTC for GitHub Actions; check your platform’s documentation for others.
Can cron run every 30 seconds?
Standard cron’s smallest interval is one minute. Use a loop, a systemd timer or a scheduler that supports seconds.
How do I check what a cron expression means?
Paste it into the generator to see it in plain English and the next run times.
Need a website or app for your business? Talk to Techpass Master – we design and build websites and apps for clients worldwide.
