NV ToolkitFormat · Validate · Convert

Cron example

Cron Every Night at 2 AM

0 2 * * *

At 02:00 AM, every day

Open in the cron expression generator

Two in the morning is the traditional maintenance window: traffic is at its lowest, the midnight rush of daily jobs has cleared, and there are still hours of runway before the working day. It is also, in most of Europe and North America, precisely the hour that daylight saving adds or removes.

By NaveenKumar T · Updated · 5-field crontab expression

What each field means

Minute, hour, day of month, month, day of week — read left to right.
FieldValueMeaning
Minute0Minute 0
Hour2Hour 2
Day of month*Every day
Month*Every month
Day of week*Every day of the week

Next 5 run times

Computing the next runs in your timezone…

Why 2 AM became the default

The hour is chosen for what is not happening: minimal user traffic, finished log rotation, and a database quiet enough for a vacuum, a reindex or a full dump to complete without competing for I/O. Backups, cache rebuilds, retention pruning and dependency updates all cluster here for that reason.

It is far enough from midnight to avoid the 00:00 stampede, and far enough from morning that a job overrunning by an hour still finishes before anyone logs in. If your window is tight, this schedule plus a hard timeout in the command is a better contract than hoping the job behaves.

The daylight saving problem, precisely

In the United States and much of Europe the clock jumps from 01:59:59 to 03:00:00 in spring. On that date the 2 AM hour does not exist on the wall clock, and a job scheduled at 02:00 local simply does not run. In autumn the hour repeats, and on most Linux crons a job pinned to 02:00 runs once, while interval schedules that pass through the hour can run twice.

Vixie cron does have special handling — jobs missed by a forward jump of less than three hours are run once when the clock lands — but the behaviour varies by daemon and distribution, and it is not something to rely on for a backup. Two safe options: run the daemon in UTC, or move the job to 0 3 * * * or 0 1 * * *, an hour that exists all year.

Related nightly patterns

For a weekday-only maintenance job, add the day-of-week restriction: 0 2 * * 1-5. For a weekly deep clean, pick a quiet day such as 0 2 * * 0. For monthly retention work, pin the day of month as the first of the month and adjust the hour.

If the nightly job has grown to the point where it no longer fits before morning, splitting it across every 6 hours usually beats moving it earlier — four smaller runs recover from a failure much faster than one big one.

Build a variant of this schedule with dropdowns and check the next ten runs before you install it.

Open the cron generator

Related cron examples

Browse every schedule on the cron expression generator, read the cron expression syntax guide for the rules behind the five fields, or the developer tools guides for the longer explanations.