Scheduling tasks with cron and systemd
The skills you will learn in this section will be concerned with scheduling periodic tasks in the system for business services and maintenance.
For regular system usage, there are tasks that need to be executed periodically, ranging from temporary folder cleanup, updating the cache’s refresh rate, and performing check-in with inventory systems, among other things.
The traditional way to set them up is via cron
, which is provided in RHEL 9 via the cronie
package.
cronie
implements a daemon that’s compatible with the traditional Vixie cron and allows us to define both user and system crontabs.
A crontab defines several parameters for a task that must be executed. Let’s see how it works.
System-wide crontab
A system-wide crontab can be defined in /etc/crontab
or in individual files at /etc/cron.d
. Other additional folders exist, such as /etc/cron.hourly
, /etc/cron.daily
, /etc/cron.weekly
, and /etc/cron.monthly...