Crontab Every Hour (0 * * * *)
Run a cron job once every hour at the top of the hour (minute 0). A fundamental cron pattern for hourly batch processing.
Detailed Explanation
Running a Cron Job Every Hour
The expression 0 * * * * runs a job at minute 0 of every hour. This is the standard way to schedule hourly tasks in cron.
Field Breakdown
| Field | Value | Meaning |
|---|---|---|
| Minute | 0 | At minute 0 |
| Hour | * | Every hour |
| Day of Month | * | Every day |
| Month | * | Every month |
| Day of Week | * | Every day |
Important Distinction
Note the difference between 0 * * * * and * * * * *:
0 * * * *— Runs once per hour at :00* * * * *— Runs every minute (60 times per hour)
The minute field must be set to a specific value (like 0) for an hourly job. If you leave it as *, the job runs every minute during that hour, not once per hour.
Using the @hourly Shorthand
Most cron implementations support the shorthand @hourly, which is equivalent to 0 * * * *. However, the explicit form is more portable and universally understood.
Staggering Hourly Jobs
If you have multiple hourly jobs, consider staggering their start times to avoid resource contention:
0 * * * * /scripts/job-a.sh
5 * * * * /scripts/job-b.sh
10 * * * * /scripts/job-c.sh
Use Case
Hourly execution is ideal for log aggregation, metric collection, cache warming, report generation, email batch sending, RSS feed polling, and any task that benefits from regular but not minute-by-minute processing.