Automate Tasks Every 20 Minutes | CronBase

cron expression Standard
$ */20 * * * *

Every twenty minutes, recurring continuously throughout the day and night.

The `*/20 * * * *` cron expression schedules a task to run every twenty minutes, specifically at the zero, twenty, and forty-minute marks of every hour, every day. It is commonly used for recurring maintenance tasks, batch data pipelines, and API synchronization jobs that require frequent updates without overloading systems.

Minute
*/20
Hour
*
Day of Month
*
Month
*
Day of Week
*

Next 5 Runs

  • in 1m 40s
  • in 21m 40s
  • in 41m 40s
  • in 1h 1m
  • in 1h 21m

* Tools

Code & Implementations

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

// Schedule task to run every 20 minutes (at :00, :20, and :40)
cron.schedule('*/20 * * * *', async () => {
  console.log(`[${new Date().toISOString()}] Starting scheduled sync...`);
  try {
    // Simulate operational work or call external service
    await performSync();
    console.log('Sync completed successfully.');
  } catch (error) {
    console.error('Execution failed:', error);
  }
});

async function performSync() {
  return new Promise((resolve) => setTimeout(resolve, 5000));
}
Setup notes

Install node-cron using 'npm install node-cron' and run this script within a long-running PM2 or Node daemon process.

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

Systemd Timer

OnCalendar*-*-* *:00/20:00

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

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

[Install]
WantedBy=timers.target

Frequently Asked Questions

What exact minutes does this cron expression trigger on?

This cron expression triggers exactly at 0, 20, and 40 minutes past every hour (e.g., 12:00, 12:20, 12:40).

How can I prevent executions from overlapping if a task takes longer than 20 minutes?

Use file locks (`flock` in Linux), distributed lock managers like Redis (Redlock), or Kubernetes concurrency policy set to `Forbid` to ensure only one instance runs at a time.

Does this cron schedule adapt automatically to Daylight Saving Time (DST) changes?

Standard cron runs based on the host system's timezone. During DST shifts, the 20-minute interval remains consistent, but the absolute hour boundary may shift by one hour.

How does this schedule compare to running a task every 15 minutes?

A 20-minute interval reduces execution frequency from 96 times a day to 72 times a day, saving system resources and downstream API rate limits while maintaining a high frequency.

Can I run this schedule only during specific business hours?

Yes, you can restrict the hour field. For example, `*/20 9-17 * * *` will run the task every 20 minutes only between 9:00 AM and 5:59 PM.

* Explore

Related expressions you might need

Was this helpful?

Last verified: