Skip to main content

Cron every 2 hours

Question

How can I write a Crontab that will run my script every 2 hours?

Answer

Use 0 */2 * * * to run your script at the top of every even-numbered hour: 00:00, 02:00, 04:00, and so on through 22:00. Add the script path after the expression in your crontab. This is a clock-based schedule, not a two-hour countdown measured from installation time or from the previous run.

crontab
# at the top of every second hour
0 */2 * * *
crontab
# the complete crontab line
0 */2 * * * /home/username/script.sh

Read the five fields as minute, hour, day of month, month, and day of week. The minute field 0 fixes each run at minute zero. The hour field */2 starts at the hour field's minimum value, 0, and selects every second hour, so it matches 0, 2, 4, 6, and the remaining even hours through 22. The three trailing wildcards match every day of the month, every month, and every day of the week. If you want the same two-hour spacing on odd-numbered hours instead, use 0 1-23/2 * * *, which runs at 01:00, 03:00, and so on through 23:00.

Run 0 */2 * * * on Crontap
Why this matters

The expression anchors runs to even clock hours. It does not remember when the script last ran, wait two hours after completion, or automatically make up a run missed while the machine was unavailable. Confusing schedule semantics with interval semantics can create a longer gap than expected after downtime. It can also cause simultaneous load spikes when many machines share the same expression and all start work at 00:00, 02:00, and the other matching hours.

Read the dedicated guide: Cron every 2 hours.

Cron schedule used

What it does

0 */2 * * *

At 0 minutes past the hour, every 2 hours, every day.

Calendar

View future cron matches in a calendar

September 2026 · UTC

0 runs

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-expression-every-number-of-hours