What is a cron job?
A cron job is a command scheduled to run automatically at set times, such as every night at two o'clock.
Drafted with AI from official documentation. Scripts were run in a test environment and repository links verified. Awaiting a human check. Did it work for you? Last edited Outdated?
A cron job is a scheduled task on Unix systems. The cron daemon wakes up every minute, checks a table of jobs, and runs anything whose time has come. It is an alarm clock for commands: set it once and it rings every day, every Monday, or every five minutes without you touching it.
Backups, log rotation, certificate renewal and report emails are classic cron jobs. Each line in a crontab has five time fields (minute, hour, day of month, month, weekday) followed by the command. The job runs with a minimal environment, so use full paths and redirect output to a log file, otherwise failures are silent. systemd timers are the modern alternative with the same purpose.
crontab -e
0 2 * * * /home/me/backup.sh >> /home/me/backup.log 2>&1
See also: What is a daemon or service? and What is a backup snapshot?
Did this work for you?
No votes yet. Be the first.
If it did not work, the report form below tells the editors what went wrong.
See also
- 0420 cron and systemd timers: run something every night Schedule a script with crontab or a systemd timer: the five cron fields, environment and PATH pitfalls, logging, catching up missed runs… Beginner · Step by step · Linux Article cron & timers · Services & systemd 15 Oct 2026
- 0424 Cron-safe wrapper: lock, log and report failures for any scheduled command Wrap any cron or timer job so it never runs twice at once, writes a timestamped log, keeps the exit code and… Intermediate · Step by step · Linux Script cron & timers · Shell scripting 15 Oct 2026
History
Every saved edit is kept. The plot on the sleeve draws one line per edit. Open any edit to see exactly what changed.
- Dominik +829 chars