Skip to main content

Offset two five-minute cron schedules by two minutes

Question

I am looking to have a script run every 5 minutes, beginning at 13:02, and another script to run every 5 minutes starting at 13:04, so the second script runs two minutes after the start of the first job. How can I accomplish this?

Answer

Use 2-59/5 * * * * for the first script and 4-59/5 * * * * for the second when you want fixed starts at :02/:07/:12 and :04/:09/:14 of every hour. This places each second-script start two minutes after the preceding first-script start. It does not wait for the first script to finish. If completion order matters, schedule one wrapper command and run the scripts sequentially, such as first-command && second-command; use && when the second should run only after the first succeeds.

crontab
# first script every five minutes, offset to minute 2
2-59/5 * * * *
crontab
# second script every five minutes, offset to minute 4
4-59/5 * * * *

Read the first cron from left to right: 2-59/5 selects every fifth minute from minute 2 through 59, and the four wildcards allow every hour and date. The second expression works the same way but starts its minute range at 4. Both expressions run all day, including before 13:02. If 13:02 is a daily lower boundary, restrict the hour field to 13-23:

crontab
# first script from 13:02 through the end of each day
2-59/5 13-23 * * *
# second script from 13:04 through the end of each day
4-59/5 13-23 * * *

Cron cannot encode a one-time start date in these recurring five fields.

Run 2-59/5 * * * * on Crontap
Why this matters

A two-minute clock offset is not a dependency guarantee. If the first script takes longer than two minutes, the second starts while it is still running; if the first fails immediately, the second still starts on schedule. That can expose partially written files, duplicate updates, or inconsistent state. Chaining the commands or using a workflow system makes completion the trigger. Restricting the hours also matters if 13:02 is a real boundary, because the wildcard-hour expressions begin firing shortly after midnight.

Read the dedicated guide: Cron every 5 minutes.

Cron schedules used

What it does

2-59/5 * * * * — command

Every 5 minutes, minutes 2 through 59 past the hour, every hour, every day.

4-59/5 * * * * — command

Every 5 minutes, minutes 4 through 59 past the hour, every hour, every day.

See this cron expression on the calendar view example

Write the cron here. Run it on Crontap.

Point Crontap at any URL. Pick any cron. Done.

WordPress, Shopify, Railway, Cloud Run, Vercel, HubSpot, Ghost, your own box. If it answers HTTP, Crontap can drive it on a clock you can read, in the timezone that actually matters, and page you when something breaks.

1.9k+ teams · Free forever tier · No credit card

Permalink: https://tool.crontap.com/help/cron-job-run-script-after-another-one-finishes