Tools › Cron examples › every 2 hours

Cron expression for every 2 hours

The cron expression for every 2 hours is:

0 */2 * * *

What it does

Runs at 00:00, 02:00, 04:00 ... 22:00.

Field by field

FieldValueMeaning
Minute0exactly 0
Hour*/2step */2
Day of month*every value
Month*every value
Day of week*every value

Typical uses

Incremental backups or refreshing slow-changing data.

Watch out for

The step is applied to the hour field only. Remember the 0 in the minute field, otherwise it runs every minute of those hours.

Add it to your crontab

crontab -e, then add:

0 */2 * * * /path/to/command >> /var/log/myjob.log 2>&1

Related schedules

every minuteevery 5 minutesevery 10 minutesevery 15 minutesevery 30 minutesevery hourevery day at midnightevery day at 3amevery weekday at 9amevery 15 minutes during business hoursevery Mondayevery Sunday at midnighton weekendson the first day of every monthon the last day of the monthevery quartertwice a day
Copied to clipboard