Every 5 Minutes on Weekdays Cron Schedule | CronBase

cron expression Standard
$ */5 * * * 1-5

Every five minutes on weekdays

This cron expression schedules a task to run every five minutes, but only on weekdays from Monday through Friday. It is ideal for continuous monitoring, high-frequency data ingestion, and API polling during standard business days, ensuring operations pause automatically over the weekend to reduce unnecessary cloud infrastructure costs.

Minute
*/5
Hour
*
Day of Month
*
Month
*
Day of Week
1-5

Next 5 Runs

  • in 4m 50s
  • in 9m 50s
  • in 14m 50s
  • in 19m 50s
  • in 24m 50s

* Tools

Code & Implementations

nodejs
const cron = require('node-cron');
const { exec } = require('child_process');

// Schedule: */5 * * * 1-5 (Every 5 minutes, Monday through Friday)
const cronExpression = '*/5 * * * 1-5';
let isRunning = false;

console.log(`Scheduler initialized. Active pattern: ${cronExpression}`);

const task = cron.schedule(cronExpression, async () => {
    if (isRunning) {
        console.warn(`[${new Date().toISOString()}] Task overlap detected; skipping execution.`);
        return;
    }

    isRunning = true;
    console.log(`[${new Date().toISOString()}] Executing weekday queue processing...`);

    try {
        await new Promise((resolve, reject) => {
            // Simulate database queue processing
            setTimeout(() => {
                const success = true;
                if (success) resolve();
                else reject(new Error('Database query failure'));
            }, 5000);
        });
        console.log(`[${new Date().toISOString()}] Queue processing completed.`);
    } catch (error) {
        console.error(`[${new Date().toISOString()}] Error during execution:`, error.message);
    } finally {
        isRunning = false;
    }
}, {
    scheduled: true,
    timezone: "UTC"
});
Setup notes

Install node-cron using npm install node-cron, then run this script using node scheduler.js in a PM2 or systemd process supervisor.

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

Systemd Timer

OnCalendarMon..Fri *-*-* *:00/5:00

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

[Timer]
OnCalendar=Mon..Fri *-*-* *:00/5:00
Persistent=true

[Install]
WantedBy=timers.target

Frequently Asked Questions

How do I prevent overlapping executions if a run takes longer than 5 minutes?

You should implement a locking mechanism such as Redis-based distributed locks, database-level flags, or file-based locks (`flock` in Linux). In Kubernetes, configure `concurrencyPolicy: Forbid` to automatically skip execution if the previous pod is still active.

What happens to the schedule during daylight saving time (DST) changes?

If your server timezone is set to a region that observes DST, the execution times will shift relative to UTC. To maintain a consistent 5-minute interval without interruption or double-execution during the fallback hour, it is highly recommended to run your cron daemon on UTC.

How can I handle the massive backlog accumulated over the weekend on Monday morning?

Design your worker to process data in small, deterministic batches rather than attempting to ingest all weekend data in a single run. Use cursor-based pagination and implement rate-limiting or backpressure to protect downstream APIs and databases from being overwhelmed.

Why does my weekday cron start running on Sunday afternoon in my local timezone?

This occurs because your cron daemon is running in UTC. Monday 00:00 UTC corresponds to Sunday evening in Western time zones (e.g., 7:00 PM EST). To fix this, you must either configure your cron environment to use your local timezone or shift the hour and day-of-week fields to compensate.

Can I exclude specific holidays that fall on weekdays from this schedule?

Standard cron syntax does not support holiday calendars. To bypass holidays, you must implement application-level logic at the beginning of your script to check the current date against a holiday list (e.g., using a library or database table) and exit early if a match is found.

* Explore

Related expressions you might need

Was this helpful?

Last verified: