CronTool
Cron expression editor & debugger
Question

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

Answer

Easy. Use the following cron:


0 */2 * * * /home/username/script.sh

The 0 at the beginning means to run at the 0th minute.

Why this matters

0 */2 * * * fires at 00:00, 02:00, 04:00, 06:00 …, 22:00 — twelve times a day. The minute field 0 pins the schedule to the top of the hour; the hour step */2 selects every even hour. If you need it pinned to odd hours instead (01:00, 03:00, …), use 0 1-23/2 * * *.


Be aware that */2 does not mean “every two hours starting from when the daemon last fired” — cron is schedule-driven, not interval-driven. If the host was offline at04:00, cron does not catch up at 04:30 when it comes back; the next run is at 06:00. For at-least-once semantics, wrap your script in a state file check or use a job runner that supports retries (Kubernetes CronJobs with startingDeadlineSeconds, AWS EventBridge dead-letter queues, etc.).


For other every-N-hour patterns, see cron every hour and the dedicated guide on cron every day for the daily-at-N-hour case.

Read the dedicated guide: Cron every hour.

Cron schedule used

Calendar

View future cron matches in a calendar

April 2026

Showing next 1000 cron schedules

Loading...

See this cron expression on the calendar → view example

Related cron questions

Other answers and worked examples for the most confusing cron expressions.

QuestionHow can I run command every six hours every day?
QuestionI am trying to add a crontab entry to execute a script every 30 minutes, on the hour and 30 minutes past the hour or something similar. How can I do this?
QuestionHow can I set up a cron job to run every night at 2:30? I am familiar with configuring it to run at 2:00, but not 2:30.
QuestionHow do you run a cron job every minute only on specific hours?

Ready to schedule it?

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.

Free forever tier ・ No credit card required

Your next schedule
GET/wp-cron.php?doing_wp_cron=1

Schedule

every 5 minutes

Next run

in 23s

Permalink: https://tool.crontap.com/help/cron-job-expression-every-number-of-hours

Apihustle Logo

This tool is part of the Apihustle suite - a collection of tools to test, improve and get to know your API inside and out.

  • Clobbr logo

    Clobbr

    The app & CLI tool to test API endpoint speed.

    Visit
  • Crontap logo

    Crontap

    Schedule recurring API calls using cron syntax.

    Visit
  • CronTool logo

    CronTool

    Debug multiple cron expressions on a calendar.

    Visit

  • Page AI

    AI Website Generator that designs and writes clean code.

    Visit
  • Shipixen

    Generate customized boilerplates in minutes.

    Visit
  • Page UI

    Landing page UI components for React & Next.js

    Visit