Cron Schedules

Every 6 Hours

Run 4 times per day at 00:00, 06:00, 12:00, and 18:00.

Pattern

0 */6 * * *

Explanation

Runs every 6 hours starting from midnight. Good for moderate-frequency tasks.

Examples

Cron Expression
Output
0 */6 * * *
Alternative
Output
0 0,6,12,18 * * *
Runs At
Output
00:00, 06:00, 12:00, 18:00

Code Examples

Crontab
# Method 1: Using */6
0 */6 * * * /path/to/task.sh

# Method 2: Explicit hours (better compatibility)
0 0,6,12,18 * * * /path/to/task.sh

# Both achieve the same result
Node.js
// Node-cron
const cron = require('node-cron');

cron.schedule('0 */6 * * *', () => {
  console.log('Running every 6 hours');
  performDataSync();
});

// Alternative with explicit hours
cron.schedule('0 0,6,12,18 * * *', () => {
  console.log('Running at midnight, 6 AM, noon, 6 PM');
});

Try it Now

💡 Tips

  • Good for data synchronization
  • Consider explicit hours for clarity
  • Works well for backup tasks
  • Less frequent than hourly, more than daily
  • Adjust starting hour if needed (e.g., 3,9,15,21)

⚠️ Common Pitfalls

  • Older cron may not support */6
  • Spans across day boundaries
  • Consider timezone for user-facing tasks