Cron job every 5 minutes: expression and example
The cron expression for every 5 minutes is */5 * * * *. Put it at the start of a crontab line, followed by the command. Below: what each of the five fields does, a sample line you can copy, the mistakes people make with this schedule, and how to get told when the job doesn't run.
The expression
A cron expression has five fields separated by spaces: minute, hour, day of month, month, day of week. An asterisk means "every"; a number means "only this one"; */n means "every nth"; a-b is a range and a,b is a list. For every 5 minutes the fields are:
| Field | Value | Meaning |
|---|---|---|
| Minute (0-59) | */5 | every 5th minute: 0, 5, 10 ... 55 |
| Hour (0-23) | * | every hour |
| Day of month (1-31) | * | every day |
| Month (1-12) | * | every month |
| Day of week (0-7, Sunday is 0 or 7) | * | every day of the week |
Example crontab line
Open the crontab with crontab -e and add one line: the expression, a space, then the command exactly as you'd type it in a shell. Syncing data from a third-party API, refreshing a cache, checking a mailbox, sending queued emails. A typical line looks like this:
*/5 * * * * /usr/bin/python3 /srv/app/sync.py >> /var/log/sync.log 2>&1
The >> file 2>&1 at the end sends both normal output and errors to a log file. Without it, cron tries to email the output to the user, which usually means it's lost.
Gotchas
- */5 means "minutes divisible by 5" (0, 5, 10, ...), not "5 minutes after the job starts". If a run takes 6 minutes, the next one starts at the next multiple of 5 and overlaps it.
- The runs are aligned to the clock, so every server on the planet with this line hits the API at the same second. If a provider rate-limits you, offset with
2-59/5(2, 7, 12 ...). - Timezone: cron uses the server's system timezone, which on most cloud servers is UTC. Run
dateon the server to see what "now" means to cron. - Environment: cron runs with a minimal PATH and no shell profile. Use full paths (
/usr/bin/python3, notpython3) and set any variables at the top of the crontab. - Output: if a job prints anything and there's no redirect or MAILTO, cron tries to send mail. Set
[email protected]at the top of the crontab or redirect output to a log. - Silence: cron does not tell you when a job fails or never starts. A job that errors every run looks exactly like a job that runs fine, unless something is watching for it.
Know when it didn't run
In short: Append && curl -fsS https://heyuptime.com/ping/<token> to the line, create a heartbeat monitor with a 5 minutes period and 5 minutes grace, and you're alerted when the job is late.
A heartbeat monitor in heyUptime is a URL your job calls when it finishes. Because of the &&, the ping is only sent when the command exits successfully, so a crashing job and a job that never started look the same: no ping. The watched line for this schedule is */5 * * * * /usr/bin/python3 /srv/app/sync.py && curl -fsS https://heyuptime.com/ping/<token>.
Set the heartbeat's period to 5 minutes and the grace to 5 minutes. If a ping doesn't arrive within period plus grace, you get an alert by email, Slack, Discord, Teams or Telegram that says when the job was last seen. With a 5-minute period and 5-minute grace you're alerted about 10 minutes after the last successful run, which is two missed runs.
To try it before signing up, the free cron job tester gives you a temporary URL for 24 hours; add it to the line and watch the ping arrive.
Questions
What is the cron expression for every 5 minutes?
*/5 * * * *. The */5 in the minute field means every minute divisible by 5: 0, 5, 10 and so on, 288 runs a day.
What is the difference between */5 and 5 in the minute field?
*/5 runs every five minutes. A plain 5 runs once an hour, at five minutes past. Mixing them up is the most common cron mistake.
How do I run a job every 5 minutes but only during working hours?
Use the hour field: */5 9-17 * * 1-5 runs every 5 minutes from 09:00 to 17:55, Monday to Friday, in the server's timezone.
Watch this job for free.
Create a heartbeat with a 5 minutes period, add one curl to the crontab line, and get told the first time it doesn't run. 14-day trial, no card.
Related
- Cron job monitoring
- Cron job tester
- Cron job every minute
- Cron job every 10 minutes
- Cron job every minute: expression and example
- Cron job every 10 minutes: expression and example
- Cron job every 15 minutes: expression and example
- Cron job every 30 minutes: expression and example
- Cron job every hour: expression and example
- Cron job every 2 hours: expression and example
Updated October 8, 2026.