Hands-on Lab·LPIC-1
Scheduling jobs with cron and systemd timers
Objective 107.2 names both cron and systemd timers, and on a current distribution the maintenance jobs have largely moved to timers. This guide writes a user crontab, finds where it is stored, reads the system crontab's extra field, and then shows the timer that does the same job with a schedule you can ask systemd to explain.
102: Administrative Tasks Guide 17 of 33 Beginner
- OSUbuntu 26.04 LTS
- Kernel7.0.0-30-generic
- systemd259
- TimeAbout 16 min
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| LPIC1-A01 | 192.168.0.76 | Ubuntu 26.04 LTS | Debian-family host - dpkg and apt, which objective 102.4 names | 2 Core | 4 GB | 50 GB |
This guide includes
Use this because the objective names both mechanisms. This matters because the system crontab has one more field than a user's - the difference that gets asked about.
- writing a user crontab, and finding where it actually lives
- meeting the extra field in the system crontab
- looking at what the machine schedules today, which is timers
- asking systemd when a schedule next fires, which cron cannot answer
Before you start
- accounts-groups-and-password-ageing
-
A user crontab, and where it actually lives
-
The system crontab has one more field
-
What the machine actually schedules today
-
Ask systemd when a schedule fires