Cron: Every 2 Hours
0 */2 * * * fires twelve times a day, on the even hour — 00:00, 02:00, 04:00, and so on through 22:00. Since 2 evenly divides 24, this step value produces a genuinely consistent, rolling interval, unlike odd step values such as 45 minutes.
0 */2 * * *
Examples & Variations
Common Mistakes
- Assuming */2 in the hour field starts counting from deploy time — like all step values, it's anchored to hour 0 (midnight), not to whenever the cron entry was created.
- Using 2-hour polling for something that needs faster feedback — this interval suits periodic sync and light maintenance, not anything user-facing that needs near-real-time updates.
- Forgetting that 0 */2 * * * still fires overnight — add an hour range (like 8-20/2) if the job should only run during waking hours.
Best Practices
- This is a solid default for moderate-cost jobs that don't need hourly freshness — cache refreshes, periodic exports, or non-urgent sync tasks.
- Combine with an hour range to restrict to business hours if the job supports a feature nobody uses overnight.
- If two different jobs both run every 2 hours, offset one to odd hours (1-23/2) so they don't compete for the same resources simultaneously.
Frequently Asked Questions
- Does 0 */2 * * * run at exactly midnight?
- Yes — step values in the hour field start from 0, so */2 always includes hour 0 (midnight) as its first match, then every 2 hours after.
- How do I run every 2 hours starting from 1 AM instead?
- Use a range with a step: 0 1-23/2 * * * produces 1 AM, 3 AM, 5 AM, and so on — odd hours instead of even ones.
- Is every 2 hours a good interval for health checks?
- It's on the slower end for health checks — most uptime monitoring wants 1–5 minute intervals to catch outages quickly. Every 2 hours suits periodic maintenance more than availability monitoring.