What is a cron job?
A cron job is a scheduled task that runs automatically on a server at specific times. Instead of clicking a button or running a script by hand, you define a schedule using cron syntax and let the system take care of it on a fixed cadence.
Cron jobs are usually managed by a background service called cron (or a compatible scheduler) that wakes up every minute, checks your schedules, and executes jobs whose time has come.
Typical things cron jobs are used for
- Nightly database backups and maintenance tasks.
- Sending daily, weekly, or monthly reports via email.
- Rotating or cleaning up log files and temporary data.
- Running ETL / data pipelines on a regular cadence.
- Triggering health checks or synthetic monitoring probes.
Anywhere you'd say "run this script every X" is usually a good candidate for a cron job.
Anatomy of a cron job
At its simplest, a cron job is one line in a crontab file. It contains a schedule and a command:
# ┌ minute (0 - 59) # │ ┌ hour (0 - 23) # │ │ ┌ day of month (1 - 31) # │ │ │ ┌ month (1 - 12) # │ │ │ │ ┌ day of week (0 - 7) (Sunday = 0 or 7) # │ │ │ │ │ # * * * * * command to run 0 2 * * * /usr/local/bin/backup-database.sh
In the example above, the backup script runs every day at 02:00 (server time). You can generate and understand expressions like this using our cron reference pages, such as:
Where cron jobs live
- User crontab: per-user schedules edited with
crontab -e. - System crontab: system-wide jobs (often
/etc/crontab) run as specific users. - Cron "directories":
/etc/cron.daily,/etc/cron.hourly, etc. - Managed platforms: Kubernetes CronJobs, GitHub Actions schedules, AWS EventBridge rules, and more.
The syntax is inspired by classic Unix cron, but each platform adds its own twists. Always check the docs for the scheduler you're actually using.
Learn cron by example
The easiest way to get comfortable with cron is to explore concrete schedules and see when they run. Our library of expressions includes visual calendars, English explanations, and code snippets for Kubernetes, GitHub Actions, and EventBridge.
FAQ about cron jobs
Do cron jobs run if the server is down?
No. Traditional cron only runs while the system scheduler is active. If your machine is powered off or the cron service is stopped, jobs scheduled during that time are missed and usually do not "catch up" once the server comes back.
Do cron jobs care about time zone or daylight saving time?
Yes. Cron uses the system or scheduler time zone by default. On days where the clock jumps forward or backward for DST, some times may be skipped or repeated. See cron timing format for more details.