Run Jobs Every Six Hours at Minute Zero | CronBase

cron expression Standard
$ 0 */6 * * *

At the start of every sixth hour, running four times a day.

The `0 */6 * * *` cron expression schedules a task to run exactly every six hours, specifically at the top of the hour. This means the job triggers four times a day, at midnight, six in the morning, noon, and six in the evening.

Minute
0
Hour
*/6
Day of Month
*
Month
*
Day of Week
*

Next 5 Runs

  • in 2h 2m
  • in 8h 2m
  • in 14h 2m
  • in 20h 2m
  • in 1d 2h

* Tools

Code & Implementations

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

// Schedule a task to run every six hours (at minute 0)
cron.schedule('0 */6 * * *', () => {
  try {
    console.log(`[${new Date().toISOString()}] Starting 6-hour system diagnostics run.`);
    // Implement your application-specific cleanup or sync logic here
  } catch (error) {
    console.error('Error executing 6-hour scheduled job:', error);
  }
}, {
  scheduled: true,
  timezone: "Etc/UTC"
});
Setup notes

Install the node-cron package using npm install node-cron. This script initializes a scheduler configured to run in UTC to prevent DST issues.

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 */6 * * ? *)

Systemd Timer

OnCalendar*-*-* 00/6:00:00

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

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

[Install]
WantedBy=timers.target

Frequently Asked Questions

At what exact times does this cron schedule execute?

This schedule executes precisely at 12:00 AM, 6:00 AM, 12:00 PM, and 6:00 PM. The execution time is determined by the system clock of the server running the cron daemon.

How does Daylight Saving Time affect this six-hour interval?

During Daylight Saving Time (DST) changes, the interval may temporarily become 5 or 7 hours depending on whether the clock skips forward or falls back. To prevent this, configure your cron environment to use Coordinated Universal Time (UTC) instead of local time.

Can I offset the execution to avoid the top-of-the-hour peak?

Yes, you can shift the execution to run at a specific minute offset, such as fifteen minutes past the hour, by changing the first field. For example, using `15 */6 * * *` will run the job at 12:15, 6:15, 12:15, and 6:15.

What happens if a six-hour job takes longer than six hours to complete?

If a job execution exceeds six hours, a new instance will start while the previous one is still running. This can cause resource exhaustion or database lock contention. You should implement a locking mechanism, such as flock in Bash or a distributed lock manager, to prevent concurrent executions.

Is this schedule suitable for high-priority transaction backups?

While a six-hour interval is excellent for general backups, high-velocity transactional databases typically require a tighter recovery point objective (RPO). For critical financial or user data, a more frequent schedule like hourly or every fifteen minutes is highly recommended.

* Explore

Related expressions you might need

Was this helpful?

Last verified: