T
ToolPrime

Cron Expression for Every 2 Hours

Run a cron job every 2 hours using 0 */2 * * *. Suitable for medium-frequency tasks that do not need hourly execution.

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 2 Hours"

systemd Timer

[Unit]
Description=Every 2 Hours timer

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

[Install]
WantedBy=timers.target

Tips

Frequently Asked Questions

What hours does 0 */2 * * * run at?

It runs at midnight (0:00), 2:00, 4:00, 6:00, 8:00, 10:00, 12:00, 14:00, 16:00, 18:00, 20:00, and 22:00.

How do I run every 2 hours starting at 1 AM?

Use 0 1-23/2 * * * or equivalently 0 1,3,5,7,9,11,13,15,17,19,21,23 * * * to run at odd hours.

Related Cron Expressions