Run a Cron Job Every 2 Hours

Runs every 2 hours at minute 0.

crontab -e
0*/2***
$0 */2 * * *

Field Breakdown

0

Minute

0–59

*/2

Hour

0–23

*

Day of Month

1–31

*

Month

1–12

*

Day of Week

0–6

How It Works

Combining minute 0 with */2 in the hour field runs the job at 00:00, 02:00, 04:00 … 22:00 — twelve times per day. Useful when hourly is too frequent but daily is too infrequent. This schedule provides consistent coverage throughout the day with manageable resource consumption.

The minute field is fixed at 0, and the hour field uses the step operator */2 to match every even hour starting from 0. This produces execution at hours 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, and 22. All other fields are wildcards, so it runs every day without restriction.

Platform Usage

Linux crontab: "0 */2 * * * /usr/local/bin/optimize-db.sh". In a Dockerfile, install cron and add this to /etc/cron.d/my-jobs. For Celery periodic tasks in Django, use crontab(minute=0, hour="*/2").

Common Use Cases

1

Periodic database optimization

2

Refreshing external data feeds

3

Running medium-frequency health checks on distributed systems

4

Clearing temporary files

try-it

$ crongen --customize "0 */2 * * *"

Want to tweak this schedule or see the next run times?

Open in Generator

Related Examples