Execute Jobs Every Five Minutes | CronBase

cron expression Standard
$ */5 * * * *

Every five minutes, continuously throughout the hour, day, and week.

The `*/5 * * * *` cron expression schedules a command to run repeatedly at five-minute intervals, specifically at minutes zero, five, ten, fifteen, and so on, every hour of every day. It is commonly used for high-frequency tasks like API polling, system health monitoring, and queue processing.

Minute
*/5
Hour
*
Day of Month
*
Month
*
Day of Week
*
How it works

Next 5 Runs

  • in 1m 37s
  • in 6m 37s
  • in 11m 37s
  • in 16m 37s
  • in 21m 37s

* Tools

Code & Implementations

Bash
#!/usr/bin/env bash
# Prevent overlapping executions using flock
LOCKFILE="/var/lock/five_minute_job.lock"
exec 9>"$LOCKFILE"

if ! flock -n 9; then
    echo "Error: Another instance of this job is already running." >&2
    exit 1
fi

echo "Starting high-frequency task at $(date)"
# Real production workload goes here
# Example: curl -sf https://api.example.com/health || exit 1
Setup notes

Save this script to /usr/local/bin/five_minute_job.sh, make it executable with chmod +x, and add it to your crontab using: */5 * * * * /usr/local/bin/five_minute_job.sh

Last verified:

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

Systemd Timer

OnCalendar*-*-* *:00/5:00

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

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

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

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

Use a locking mechanism. In Bash, wrap your command with `flock -n /var/lock/myjob.lock`. In application code, implement a distributed lock using Redis (Redlock) or a database-backed state lock to ensure only one instance runs at a time.

Will changing the system timezone affect this 5-minute schedule?

Because this expression runs continuously every five minutes regardless of the hour or day, timezone shifts (such as Daylight Saving Time) will not interrupt the frequency. The job will continue to execute every five minutes, though timestamp logs will reflect the timezone change.

How can I monitor if my 5-minute cron job fails silently?

Implement 'dead man's switch' monitoring (e.g., Healthchecks.io or Opsgenie). Have your script send an HTTP ping to an external service at the end of each successful run. If the service doesn't receive a ping within 6 or 7 minutes, it triggers an alert.

What is the performance impact of running a database query every 5 minutes?

If the query is unindexed or scans large tables, it can degrade database performance and exhaust connection pools. Ensure your queries use indexes, keep connection durations short, use connection pooling, and implement strict read timeouts.

Can I offset this job to run at minutes 2, 7, 12 instead of 0, 5, 10?

Yes, you can shift the execution offset by changing the expression to `2/5 * * * *`. This is highly recommended in shared hosting or microservice environments to avoid resource spikes that occur when multiple jobs align at the top of the 5-minute mark.

* Explore

Related expressions you might need

Last verified:

Was this helpful?