Skip to content
fasttools.me
Run Cron Job Every Day at 2 AM (0 2 * * *)

Run Cron Job Every Day at 2 AM (0 2 * * *)

Crontab 0 2 * * *: Run cron jobs every day at 2am off-peak. Instant copyable crontab line, next run countdowns, and database backup script templates.

To run a cron job daily at 2:00 AM in Linux, use the expression 0 2 * * *. The 0 specifies minute zero and 2 specifies 2:00 AM in 24-hour military notation, firing once every 24 hours during the deepest off-peak window.

POSIX Cron Expression (5-Field)
Valid Syntax
Natural Language Schedule

At 02:00, every day

Standard Schedule PresetsClick to load

Interactive 5-Field Workbench

Adjust individual cron segments in real time with instant two-way synchronization.

1. Minute0
0 – 59
2. Hour2
0 – 23 (24h)
3. Day of Month*
1 – 31
4. Month*
1 – 12 (Jan – Dec)
Select Month
5. Day of Week*
0 – 6 (Sun – Sat)
Select Day

Next 5 Scheduled Executions

Real-time schedule timetable projected forward from current timestamp.

12026-11-06 20:00:00 UTC
in 14h 23m
22026-11-07 20:00:00 UTC
in 1d 14h
32026-11-08 20:00:00 UTC
in 2d 14h
42026-11-09 20:00:00 UTC
in 3d 14h
52026-11-10 20:00:00 UTC
in 4d 14h

Crontab Command Snippet

Enter your executable command or script path to generate the full crontab configuration line.

Ready to paste in `crontab -e`0 2 * * * curl -fsS https://example.com/cron-job
Runs in system timezone or explicit TZ variablePOSIX Spec
MULTI-RUNTIME DEVOPS CONFIGURATION

Copy Ready-to-Deploy Manifests for `0 2 * * *`

Export this schedule directly to your target cloud orchestrator, CI/CD pipeline, or Linux server.

crontab -ePOSIX Standard
# Linux Crontab Entry (edit with: crontab -e)
SHELL=/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# Schedule: 0 2 * * *
0 2 * * * curl -fsS https://api.fasttools.me/health >> /var/log/cron-task.log 2>&1
DevOps Deployment Tip: Crontab runs with a minimal environment. Always define explicit PATH and redirect stdout/stderr to prevent mail queue buildup.
Advertisement
Sponsored Developer Space
Cron Field Syntax Mapping

Field-by-Field Breakdown of `0 2 * * *`

PositionField NameAllowed ValuesValue in `0 2 * * *`Evaluation Meaning
1Minute0 – 5900 (At minute 0)
2Hour0 – 2322 (At 2:00 AM / 02:00)
3Day of Month1 – 31** (Every day of the month: 1-31)
4Month1 – 12** (Every month: 1-12)
5Day of Week0 – 6 (Sun-Sat)** (Every day of the week: 0-6)
Technical Engineering Analysis

The 2 AM Deep Maintenance Standard

2:00 AM (0 2 * * *) is globally recognized as the ideal time for heavy database vacuums, full disk integrity audits, and filesystem backups. For web services hosted in North America and Europe, user traffic reaches its lowest point between 2:00 AM and 4:00 AM local time.

Running heavy jobs at 2:00 AM ensures that any temporary latency spike or database table lock completes long before business users log in at 8:00 AM.

To avoid the DST missing hour bug where spring forward skips 2:00 AM entirely on local timezones, production servers should always operate in UTC.

Real-World Server Implementations

Common Production Scenarios for `0 2 * * *`

Case 01

Full Encrypted Database Dump to R2/S3

Dumps PostgreSQL or MariaDB clusters, encrypts with GPG keys, and streams to geo-redundant S3 cold storage.

pg_dumpall | gpg -e -r admin@fasttools.internal | aws s3 cp - s3://backups/db-$(date +%F).sql.gpg
Case 02

Operating System Kernel & Security Updates

Runs unattended package upgrades on Ubuntu and Debian instances, patching CVE security flaws without user disruption.

/usr/bin/unattended-upgrade -d
Case 03

Redis Database RDB Snapshot Persistence

Executes BGSAVE on Redis in-memory databases to persist memory states to disk storage safely.

redis-cli bgsave
Operational Traps & Failure Modes

Production Gotchas When Running `0 2 * * *`

  • The DST Spring Forward Bug: If your server uses local US or European time, 2:00 AM is skipped during the spring DST shift! Run servers on UTC.
  • Network Bandwidth Caps: Streaming 50GB database dumps at 2:00 AM can saturate server network interfaces. Throttle bandwidth with pv -L 10M.
  • Lockfile Omission: If a 2 AM backup hangs, the next day's backup at 2 AM could corrupt the archive without flock protection.

Frequently Asked Questions About `0 2 * * *`

What does crontab 0 2 * * * mean?

The expression 0 2 * * * schedules a command to run once every day at 2:00 AM (02:00). For example: 0 2 * * * /usr/local/bin/backup.sh runs your backup daily at 2 AM.

Why is 2 AM preferred for database backups?

2:00 AM is the global trough of web application traffic, minimizing the performance impact of database locks and disk I/O spikes.

How do I run a job at 2:30 AM?

Set minute to 30 and hour to 2: 30 2 * * * /path/to/script.sh.

How does DST affect 2 AM cron jobs?

On local-time servers, the spring forward clock jump skips 2:00 AM entirely, causing cron to skip the job. Always set server clocks to UTC (timedatectl set-timezone UTC).

Related Cron Schedule Generators