Let your server work while you sleep. In this episode you'll learn how cron works: the 5 time fields of a crontab line, the schedule patterns you'll use every day (every 5 minutes, hourly, weekly, @reboot), how to add jobs with crontab -e, a real backup script that cleans up old backups, why jobs work in the terminal but fail in cron (PATH, relative paths, the % sign), how to check if a job ran with the journal and your own log file, system-wide jobs and systemd timers, and the most common mistakes.

⏱ Chapters
0:00 Who works at 2 AM?
0:17 The crontab line: 5 time fields
0:35 Schedule examples (*/5, @reboot)
1:00 Add a job with crontab -e
1:20 A real backup script
1:38 Works in terminal, not in cron?
2:01 Did it run? Logs
2:18 System jobs & systemd timers
2:37 Common mistakes
2:57 Cheat sheet
3:13 Like & subscribe
3:25 Homework & up next

⌨️ Commands from this video
crontab -e edit your cron jobs (pick nano the first time)
crontab -l list your cron jobs
30 2 * * * /home/USER/backup.sh run the backup every day at 2:30
(then add: two greater-than signs + /home/USER/backup.log + 2 greater-than ampersand 1, to save output and errors to a log)
*/5 * * * * every 5 minutes
0 * * * * every hour, on the hour
0 3 * * 0 every Sunday at 3 AM
0 9 1 * * 9 AM on the 1st of every month
@reboot once, every time the server starts
chmod +x backup.sh make the script executable
./backup.sh always run it by hand first
journalctl -u cron --since today did cron run the job?
tail -3 backup.log did the job work?
sudo crontab -e jobs that run as root
/etc/cron.daily/ drop a script in: runs once a day
systemctl list-timers systemd timers: the modern alternative
timedatectl check the server's time zone

💡 Not sure about a schedule? Paste it into crontab.guru.
⚠️ Cron has a tiny PATH and doesn't start in your folder: always use full paths, and escape % as \%.

📺 Full course playlist:
◀ Previous – #12 Disks & Storage: df, du & mount: [EP12 LINK]
▶ Next – #14 Bash Scripting Basics: coming soon

💬 Homework: create a cron job that writes the date into a file every 5 minutes, check that it works, then remove it. Tell me in the comments how it went!

👍 If this helped, like & subscribe, it keeps the course free.
© netacademy.ge

#Linux #UbuntuServer #SysAdmin

Last modified: Sunday, 6 December 2026, 10:07 AM