Linux 101 : Systemd timers - Scheduling tasks -
Systemd uses .service files to get information about how to start processes, independencies and other parameters.
We will create a service file called "backup.service".
The most important part of the .service file is "ExecStart" which indicates the program to be started by systemd - backup.py for example -.
Our .service file could look like the below - backup.service -:
To schedule the program, we need the .timer file - works with systemd timers -, an it indicates to systemd when to run the program.
For that purpose, we need to add a [Timer] section in our file - backup.timer -.
Below is our .timer file - backup.timer - that is tied to the above unit - backup.service -:
Then we can reload our systemd daemon:
The .timer file manages the the .service file, so we need to enable the timer units are seen above.
To check all launched timers on our system, we use: