T
ToolPrime

Cron Expression for Every Other Hour

Run a cron job every 2 hours using 0 */2 * * *. Identical to every-2-hours, running 12 times per day at even hours.

Expression

0 */2 * * *

Every 2 hours at minute 0

Use Cases

Code Examples

Crontab

# Every 2 hours at minute 0
0 */2 * * * /path/to/your/script.sh

GitHub Actions

name: Scheduled Job
on:
  schedule:
    - cron: '0 */2 * * *'
jobs:
  run:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: echo "Running Every Other Hour"

systemd Timer

[Unit]
Description=Every Other Hour timer

[Timer]
OnCalendar=*-*-* *:*:00
Persistent=true

[Install]
WantedBy=timers.target

Tips

Frequently Asked Questions

What is the difference between every other hour and every 2 hours?

They are the same thing. "Every other hour" and "every 2 hours" both use */2 in the hour field and run at hours 0, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22.

Can I start the every-other-hour cycle at a different hour?

Yes, use a range with step: 0 1-23/2 * * * starts at 1 AM and runs every 2 hours (1, 3, 5, 7, ...).

Related Cron Expressions