Run Every 30 Minutes Cron Schedule | CronBase

cron expression Standard
$ */30 * * * *

Every half hour, running on the hour and thirty minutes past the hour, every day.

The `*/30 * * * *` cron expression schedules a task to execute every thirty minutes, specifically at the top of the hour and thirty minutes past the hour. This high-frequency cadence is commonly used for automated system health checks, periodic database cache invalidation, API synchronization, and active monitoring tasks.

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

Next 5 Runs

  • in 1m 42s
  • in 31m 42s
  • in 1h 1m
  • in 1h 31m
  • in 2h 1m

* Tools

Code & Implementations

nodejs
// Install: npm install node-cron
const cron = require('node-cron');

let isJobRunning = false;

// Schedule to run every 30 minutes (*/30 * * * *)
cron.schedule('*/30 * * * *', async () => {
    if (isJobRunning) {
        console.warn(`[${new Date().toISOString()}] Previous job execution is still in progress. Skipping execution.`);
        return;
    }

    isJobRunning = true;
    console.log(`[${new Date().toISOString()}] Initiating periodic cache sync job...`);

    try {
        // Simulate an asynchronous API synchronization task
        await performCacheSync();
        console.log(`[${new Date().toISOString()}] Cache sync completed successfully.`);
    } catch (error) {
        console.error(`[${new Date().toISOString()}] Error during cache sync:`, error);
    } finally {
        isJobRunning = false;
    }
});

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

Run this script as a daemon process using PM2 or systemd to ensure continuous execution of the thirty-minute interval scheduler.

Partner BetterStack

Monitor this schedule in production

Get alerted the moment this cron job fails, is late, or doesn't run. BetterStack tracks execution, duration, and output — no infrastructure required.

Platform Equivalents

AWS EventBridge

Standard cron expressions often need conversion for AWS EventBridge schedules.

EventBridge Rule
cron(*/30 * * * ? *)

Systemd Timer

OnCalendar*-*-* *:00/30:00

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

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

[Install]
WantedBy=timers.target

Frequently Asked Questions

How do I prevent two instances of this job from running concurrently?

Implement a locking mechanism. In Kubernetes, set concurrencyPolicy to Forbid. In Linux shell scripts, use the flock utility to acquire an exclusive lock on a file descriptor before executing the main payload.

What happens to this schedule during Daylight Saving Time (DST) transitions?

Because this cron runs twice an hour, DST shifts do not affect the interval consistency. The job will continue to run every thirty minutes without interruption, though the absolute wall-clock hour will change.

Can I offset this job to run at 15 and 45 minutes past the hour instead?

Yes, you can modify the expression to '15,45 * * * *'. This is highly recommended in shared environments to avoid the resource spikes associated with running exactly on the hour.

How should I monitor a job that runs at this frequency?

Implement dead man's snitch monitoring (heartbeat alerts). Since the job runs regularly, set up an alert that triggers if no successful execution ping is received within 35 to 40 minutes.

Is this schedule suitable for heavy database migrations or backups?

No, a thirty-minute interval is generally too frequent for heavy operations. If a backup fails or hangs, it can quickly cascade and deplete database connections. Use daily or weekly schedules for intensive tasks.

* Explore

Related expressions you might need

Was this helpful?

Last verified: