How to Run a Job Every 3 Hours | CronBase

cron expression Standard
$ 0 */3 * * *

Every three hours, on the hour.

The `0 */3 * * *` cron expression schedules a task to run every three hours, precisely at the start of the hour. Executions occur eight times a day at midnight, 3:00 AM, 6:00 AM, 9:00 AM, noon, 3:00 PM, 6:00 PM, and 9:00 PM, typically configured in UTC.

Minute
0
Hour
*/3
Day of Month
*
Month
*
Day of Week
*
How it works

Next 5 Runs

  • in 36m 46s
  • in 3h 36m
  • in 6h 36m
  • in 9h 36m
  • in 12h 36m

* Tools

Code & Implementations

Bash
#!/usr/bin/env bash
set -euo pipefail

# Lockfile to prevent overlapping executions
LOCKFILE="/var/run/tri_hourly_job.lock"

# Run with flock to ensure exclusive execution
0 */3 * * * /usr/bin/flock -n "$LOCKFILE" /usr/local/bin/my-task.sh >> /var/log/my-task.log 2>&1
Setup notes

Add this entry to your system crontab using 'crontab -e'. It utilizes flock to ensure that if a previous run is still active, the new run exits gracefully without overlapping.

Last verified:

Partner UptimeRobot

Keep this cron job monitored 24/7

UptimeRobot alerts you the moment a scheduled job stops responding. Free plan monitors up to 50 endpoints — no credit card required.

Platform Equivalents

AWS EventBridge

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(0 */3 * * ? *)

Systemd Timer

OnCalendar*-*-* 00/3:00:00

my-task.timer
[Unit]
Description=Timer for cron expression: 0 */3 * * *

[Timer]
OnCalendar=*-*-* 00/3:00:00
Persistent=true

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

At what exact times of the day does this cron schedule execute?

The job executes at midnight (00:00), 3:00 AM, 6:00 AM, 9:00 AM, 12:00 PM (noon), 3:00 PM, 6:00 PM, and 9:00 PM. All executions occur at the exact beginning of the hour (minute 0).

What happens to the 3-hour interval during Daylight Saving Time (DST) changes?

If your system runs on local time, spring-forward transitions can skip the 2:00 AM hour (meaning the next run is at 3:00 AM, causing a shorter interval), and autumn fall-backs can repeat the 1:00 AM hour, causing duplicate runs. Running your cron daemon in UTC completely eliminates this issue.

How can I prevent overlapping executions if a job takes longer than 3 hours?

You should use locking mechanisms. In Kubernetes, set concurrencyPolicy: Forbid. In Linux, wrap your script with the flock utility. In application code, implement distributed locks using Redis, Consul, or database-level advisory locks.

How can I offset this job to avoid high-concurrency resource spikes on the hour?

To avoid the 'thundering herd' problem, shift the minute field to a non-zero value, such as 15 */3 * * * (running at 15 minutes past the hour) or introduce a randomized sleep/jitter at the start of your script.

Is this expression compatible with AWS EventBridge or CloudWatch Events?

AWS EventBridge uses a 6-field cron format where the last field is the year and '?' is used for the day-of-week/day-of-month wildcard. Standard '0 */3 * * *' needs to be adapted to conform to AWS's specific syntax rules.

* Explore

Related expressions you might need

Last verified:

Was this helpful?