How to use the Cron Job Every Hour
- Copy
0 * * * *and put your command after it in your crontab (open it withcrontab -e). - Check the next run times below, in UTC or your server's time zone.
- Need something slightly different? Edit any field and the description updates as you type.
The crontab line
0 * * * * /path/to/your-script.sh >> /var/log/your-script.log 2>&1
The five fields are minute, hour, day of month, month and day of week. Redirecting output to a log file (>> … 2>&1) keeps errors you'd otherwise never see.
Good for
- Hourly reports and log rotation
- Refreshing search indexes or sitemaps
- Sending digest emails
Variations
30 * * * * | Every hour at half past |
0 */2 * * * | Every 2 hours, on the hour |
0 9-17 * * 1-5 | Every hour during office hours on weekdays |
@hourly | Shortcut for 0 * * * * |
Same schedule elsewhere
| GitHub Actions | on: schedule: - cron: '0 * * * *' (always UTC) |
|---|---|
| Kubernetes | spec.schedule: "0 * * * *" in a CronJob |
| Vercel | "crons": [{"path": "/api/job", "schedule": "0 * * * *"}] in vercel.json |
Frequently asked questions
Why does * * * * * not mean every hour?
An asterisk in the minute field means every minute. Put 0 there to run once per hour.
What time zone does it use?
The time zone of the machine or service running cron, which is usually UTC on servers and cloud schedulers. GitHub Actions always uses UTC.