Cron job every 2 hours
To run a cron job every 2 hours, use 0 */2 * * *. In plain English: every 2 hours, on the hour. That is 12 times a day.
“Every 2 hours, on the hour”
Next runs
- Calculating…
Cron fails silently. Add one curl line and we’ll email you the minute a run is missed.
What each field means
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | 0 |
| Hour | */2 | every 2 hours, starting at 00:00 |
| Day of month | * | every day of month |
| Month | * | every month |
| Day of week | * | every day of week |
Copy-paste examples
Each example ends with a heartbeat ping, so you hear about it when a run is missed. Get your ping URL (free).
# crontab -e
0 */2 * * * /path/to/job.sh && curl -fsS -m 10 --retry 3 https://croncanary.xyz/ping/YOUR-PING-TOKEN > /dev/null
# report failures too:
0 */2 * * * /path/to/job.sh && curl -fsS -m 10 https://croncanary.xyz/ping/YOUR-PING-TOKEN || curl -fsS -m 10 https://croncanary.xyz/ping/YOUR-PING-TOKEN/fail⚠︎ crontab uses the server's local time zone (or CRON_TZ / TZ if set).
on:
schedule:
- cron: '0 */2 * * *'
jobs:
every-2-hours:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: ./job.sh
- if: success()
run: curl -fsS -m 10 --retry 3 https://croncanary.xyz/ping/YOUR-PING-TOKEN
- if: failure()
run: curl -fsS -m 10 https://croncanary.xyz/ping/YOUR-PING-TOKEN/fail⚠︎ GitHub Actions schedules run in UTC and can be delayed under load. A missed or late run is exactly what monitoring catches.
apiVersion: batch/v1
kind: CronJob
metadata:
name: every-2-hours
spec:
schedule: "0 */2 * * *"
timeZone: "Etc/UTC"
concurrencyPolicy: Forbid
jobTemplate:
spec:
template:
spec:
restartPolicy: OnFailure
containers:
- name: job
image: your-image:latest
command: ["/bin/sh", "-c", "./job.sh && wget -qO- https://croncanary.xyz/ping/YOUR-PING-TOKEN"]{
"crons": [{ "path": "/api/every-2-hours", "schedule": "0 */2 * * *" }]
}
// at the end of your /api/every-2-hours handler:
await fetch("https://croncanary.xyz/ping/YOUR-PING-TOKEN");⚠︎ On the Vercel Hobby plan, cron jobs can run at most once per day. This schedule needs a Pro plan.
Your job runs every 2 hours. Will you know when it doesn’t?
Backups that stopped weeks ago, invoices that never went out, a cache that quietly went stale. Add a single curl line and you get an email the minute a run is missed, plus another when it recovers.
5 monitors free forever · no credit card · 30-second setup
- 1Create a monitorPaste your schedule. We work out when each ping should arrive.
- 2Add the pingcurl your unique URL at the end of the job.
- 3Get alertedA ping is late or reports a failure, and you get an email or Slack message.
FAQ
- What is the cron expression for every 2 hours?
- Use 0 */2 * * *. It means: every 2 hours, on the hour. That is 12 times a day.
- Which time zone does "0 */2 * * *" run in?
- It depends on the scheduler. crontab uses the server's local time zone (or CRON_TZ when set). GitHub Actions and Vercel Cron always use UTC. Kubernetes uses UTC unless you set spec.timeZone.
- How do I know if my cron job every 2 hours stopped running?
- Cron doesn't tell you when a job fails or never starts. Add a heartbeat: after the job succeeds, request a unique ping URL. CronCanary expects that ping 12 times a day and emails you if it doesn't arrive on time. The first 5 monitors are free.