Scheduling tasks with cron and systemd113
As you can see, it is set as a dependency of another target (multi-user.target) and has some
requirements on other services, such as display-manager.service, and also other conflicts, and the target can only be reached when other targets have completed.
In this way, systemd can select the proper order of services to start and the dependencies to reach the configured boot target.
Just in case, we can switch to anew runlevel with systemctl isolate targetname.target.
With that, we have covered the service’s status,
as well as how to start, stop, and enable it on boot, but there are other tasks we should execute in our system, but in a periodic way. Let’s get further into this topic.
Scheduling tasks with cron and systemdThe 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 fora task that must be executed. Let’s see how it works.
Share with your friends: