Crontab Daily at Midnight (0 0 * * *)

Run a cron job once a day at midnight (00:00). The most common daily schedule for backups, cleanups, and report generation.

Daily0 0 * * *

Detailed Explanation

Running a Cron Job Daily at Midnight

The expression 0 0 * * * schedules a job to run at exactly midnight (00:00) every day. This is the default daily cron pattern and equivalent to the @daily shorthand.

Field Breakdown

Field Value Meaning
Minute 0 At minute 0
Hour 0 At midnight
Day of Month * Every day
Month * Every month
Day of Week * Every day

The @daily Shorthand

Most cron implementations support @daily (or @midnight) as a shorthand for 0 0 * * *. While convenient, the explicit 5-field form is more portable across different systems and scheduling tools.

Timezone Considerations

Midnight means different things depending on your server's timezone. If your server runs in UTC but you want the job at midnight Eastern Time, you have two options:

  1. Convert manually: Eastern midnight = 05:00 UTC → use 0 5 * * *
  2. Set the CRON_TZ variable (where supported):
CRON_TZ=America/New_York
0 0 * * * /scripts/nightly-backup.sh

Common Midnight Jobs

0 0 * * * /scripts/daily-backup.sh
0 0 * * * /scripts/log-rotate.sh
0 0 * * * /scripts/cleanup-temp.sh
0 0 * * * /scripts/generate-daily-report.sh

Use Case

The midnight schedule is the industry standard for daily operations: database backups, log rotation, temporary file cleanup, daily summary reports, analytics aggregation, billing calculations, and SSL certificate renewal checks.

Try It — Crontab Cheat Sheet

Open full tool