- Alright. In this video, I want to
show you systemd timers.
Let me do a sudo systemctl
list units minus t timer.
That's how we can see all the systemd timers.
There's only four of them currently active.
That's not very much, so
let's change that command into list unit files.
Sudo systemctl list unit files minus t timer.
And there we can see a couple more systemd timers.
So here we see fstrim.timer fringes.
It's disabled... disabled. That doesn't matter.
We are going to investigate how it works.
I am going to use
systemctl
list unit files
Fstrim *.
And there we can see that we have
an fstrim timer and we have an fstrim service.
Now this is the first thing that you
need to know about systemd timers.
You have something dot timer, and something dot timer
needs something dot service, because the timer is
the modifier to the service.
The service is what you normally do... use to start
your service, and the timer is
how you can apply a timer to it.
Now if you sudo
systemctl
cat
on fstrim.timer,
now we can see what it is doing.
So we have the unit section, and most importantly
we have the timer section.
And in the timer section, we have this OnCalender,
it's weekly,
and AccuracySec and the position is true
and the RandomizedDelay is 6000.
Now the only thing that really matters is
the OnCalender is weekly. That means that systemd
is going to make sure that this timer is going
to run weekly.
But what exactly is it going to run?
Well, the corresponding service.
That is how timers are using.
Whatever dot timer is looking for, whatever dot service.
And when the moment has come that this timer
is going to be activated, it will run fstrim.service.
And that's all that you need to know about timers for now.
Once you get deeper in the Linux operating system,
you will learn how to create your own timers
and what exactly to do in there.
But for now, understanding them is enough.