Scheduling tasks to run once per hour, daily at midnight, or at specific times during the day is the backbone of server administration and backend development. Setting up a cron every hour, every day at midnight, or every 6 hours requires understanding how the 5 standard Unix cron fields interact.
Below is a complete reference of all daily and hourly cron schedule expressions, ready to copy and paste directly into your crontab or task scheduler.
Quick copy-paste daily & hourly cron expressions
- Every hour on the hour: 0 * * * *
- Every 2 hours: 0 */2 * * *
- Every 3 hours: 0 */3 * * *
- Every 4 hours: 0 */4 * * *
- Every 6 hours (4 times a day): 0 */6 * * *
- Every 12 hours (twice a day): 0 */12 * * *
- Every day at midnight (00:00): 0 0 * * *
- Every day at 1:00 AM: 0 1 * * *
- Every day at 6:00 AM: 0 6 * * *
- Every day at 12:00 PM (Noon): 0 12 * * *
- Every day at 6:00 PM (18:00): 0 18 * * *
- Every day at 11:30 PM (23:30): 30 23 * * *
Breaking down: Cron every hour (0 * * * *)
The most common beginner mistake with hourly cron jobs is writing * * * * *. An asterisk in the minute field means "every minute", causing the task to execute 60 times per hour. To run once per hour, you must fix the minute field to a specific number, such as 0 (for the top of the hour) or 15 (at 15 minutes past the hour):
# Runs at 00:00, 01:00, 02:00, ... 0 * * * * /usr/bin/python3 /scripts/hourly-sync.py # Runs at 00:15, 01:15, 02:15, ... 15 * * * * /usr/bin/python3 /scripts/hourly-cleanup.py
Breaking down: Cron every day at midnight (0 0 * * *)
To run a job once per day at midnight, set both minute and hour to 0. The remaining fields (day of month, month, day of week) remain wildcards (*):
# Minute 0, Hour 0, Every Day, Every Month, Every Day of Week 0 0 * * * /usr/bin/bash /backup/daily-backup.sh
Running jobs twice a day (Specific hours)
To run a script at specific times (e.g., 9:00 AM and 9:00 PM), use a comma-separated list in the hour column:
# Runs at 09:00 and 21:00 every day 0 9,21 * * * /usr/bin/node /app/report.js
Timezone traps in daily cron jobs
Cloud servers (such as Ubuntu on AWS EC2 or DigitalOcean) almost always run in UTC (Coordinated Universal Time). If you configure a backup for 0 0 * * * thinking it will run at your local midnight in New York (EDT, UTC-4), it will actually execute at 8:00 PM local time. Always check your server timezone with the "timedatectl" or "date" command.
Frequently asked questions
The cron expression for every hour on the hour is 0 * * * *. This runs at minute 0 of every hour.
The cron expression for every day at midnight is 0 0 * * *. This runs at 00:00 (12:00 AM) every day.
Use step values: 0 */2 * * * runs every 2 hours on the hour (00:00, 02:00, 04:00, etc.), and 0 */6 * * * runs every 6 hours (00:00, 06:00, 12:00, 18:00).
Cron runs in the server timezone (typically UTC on AWS, DigitalOcean, and GCP). If your local timezone is EST (UTC-5), a 00:00 UTC job fires at 7:00 PM EST. Always verify your server timezone or use CRON_TZ.