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
*

Next 5 Runs

  • in 2h 2m
  • in 5h 2m
  • in 8h 2m
  • in 11h 2m
  • in 14h 2m

* Tools

Code & Implementations

nodejs
const cron = require('node-cron');
const log = require('fancy-log');

// Schedule task to run every 3 hours (0 */3 * * *)
cron.schedule('0 */3 * * *', async () => {
  log.info('Starting tri-hourly scheduled task...');
  try {
    await performTask();
    log.info('Task completed successfully.');
  } catch (error) {
    log.error('Task failed with error: ', error);
  }
}, {
  scheduled: true,
  timezone: 'UTC'
});

async function performTask() {
  // Production task logic goes here
  return Promise.resolve();
}
Setup notes

Install 'node-cron' and 'fancy-log' via npm. Run this process using a process manager like PM2 to ensure high availability and proper log capture.

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

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

Was this helpful?

Last verified: