In this case, you will need two cron jobs:
2-59/5 * * * * command
4-59/5 * * * * commandThis will result in the first command running every 5 minutes, starting with an offset of 2 minutes at the beginning of each hour, and the second command behaving similarly with an offset of 4 minutes.
Cron has no concept of “run B after A finishes”. It's a time-based scheduler, not a workflow engine. The closest you can get is: schedule both jobs on the same fixed-interval cadence, with a phase offset that's big enough to assume A is done before B starts.
The 2-minute offset above assumes the first job's usual runtime is well under 2 minutes. If A occasionally takes 5+ minutes, B will start while A is still running — and you're back where you started. For proper dependency ordering you need a wrapper script (lock file + flock), a queue (Redis, RabbitMQ), or a workflow tool (Airflow, Temporal, Argo).
If you only care that B runs after A's schedule fires, you can combine them in a single shell command on a single cron line: 2-59/5 * * * * (commandA && commandB). The && only runs B if A succeeded; ; runs B regardless.
Read the dedicated guide: Cron every 5 minutes.
Other answers and worked examples for the most confusing cron expressions.
Ready to schedule it?
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.
Free forever tier ・ No credit card required
Schedule
“every 5 minutes”
Next run
in 23s
Permalink: https://tool.crontap.com/help/cron-job-run-script-after-another-one-finishes