Configure Every 45-Minute Cron Jobs | CronBase

cron expression Standard
$ */45 * * * *

At the start of every hour and forty-five minutes past every hour.

This cron expression triggers a job twice every hour, specifically at the top of the hour and forty-five minutes past the hour. Because standard cron resets step intervals at hour boundaries, this creates alternating execution gaps of forty-five and fifteen minutes, which is ideal for lightweight, non-continuous recurring tasks.

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

Next 5 Runs

  • in 21m 37s
  • in 36m 37s
  • in 1h 21m
  • in 1h 36m
  • in 2h 21m

* Tools

Code & Implementations

Bash
#!/usr/bin/env bash
# Production-ready wrapper for cron execution with file locking
set -euo pipefail

LOCKFILE="/var/run/my_45min_job.lock"
LOGFILE="/var/log/my_45min_job.log"

# Ensure single execution using flock to avoid overlapping runs
exec 200>"$LOCKFILE"
if ! flock -n 200; then
    echo "[$(date -u)] Execution skipped: Job is already running." >> "$LOGFILE"
    exit 0
fi

echo "[$(date -u)] Starting 45-minute interval task..." >> "$LOGFILE"

# Actual task execution
if /usr/local/bin/my-app-task >> "$LOGFILE" 2>&1; then
    echo "[$(date -u)] Task completed successfully." >> "$LOGFILE"
else
    echo "[$(date -u)] ERROR: Task failed with exit code $?" >> "$LOGFILE" >&2
    exit 1
fi
Setup notes

Save this script to /usr/local/bin/run-task.sh, make it executable with 'chmod +x', and register it in your system crontab using 'crontab -e' with the line: */45 * * * * /usr/local/bin/run-task.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(*/45 * * * ? *)

Systemd Timer

OnCalendar*-*-* *:00/45:00

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

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

[Install]
WantedBy=timers.target

Last verified:

Frequently Asked Questions

Why does this schedule run twice an hour instead of every 45 minutes continuously?

Standard cron evaluates fields independently. The expression `*/45` translates to "every 45th minute starting from 0 within the current hour," matching only minute 0 and 45. The interval resets at the top of the next hour, creating a 15-minute gap.

How can I achieve a true rolling 45-minute execution interval?

To run exactly every 45 minutes without hour-boundary resets, you should avoid standard cron. Instead, use an application-level scheduler like Celery, Hangfire, or Go's ticker, or run a continuous background daemon with a sleep/delay loop.

What happens if my job takes longer than 15 minutes to complete?

If a job started at minute 45 runs longer than 15 minutes, it will overlap with the next execution at minute 0. You must implement locking mechanisms (like flock in Bash or redis-locks in Node) or set concurrency policies to prevent concurrent runs.

How do daylight saving time (DST) shifts affect this 45-minute schedule?

During a DST shift, your system clock may jump forward or backward. Since this schedule runs relative to the wall clock (at minute 0 and 45), a shift will cause one interval to be skipped or repeated. Run your cron daemon in UTC to avoid this.

Can I restrict this 45-minute cadence to only run during business hours?

Yes, you can modify the hour field. For example, `*/45 9-17 * * 1-5` will restrict the executions to minute 0 and 45 of every hour between 9:00 AM and 5:45 PM, Monday through Friday.

* Explore

Related expressions you might need

Last verified:

Was this helpful?