1 00:00:06,600 --> 00:00:08,550 - Alright. In this video, I want to 2 00:00:08,550 --> 00:00:10,650 show you systemd timers. 3 00:00:10,650 --> 00:00:12,780 Let me do a sudo systemctl 4 00:00:12,780 --> 00:00:16,200 list units minus t timer. 5 00:00:16,200 --> 00:00:19,200 That's how we can see all the systemd timers. 6 00:00:19,200 --> 00:00:21,720 There's only four of them currently active. 7 00:00:21,720 --> 00:00:23,880 That's not very much, so 8 00:00:23,880 --> 00:00:28,155 let's change that command into list unit files. 9 00:00:28,155 --> 00:00:32,340 Sudo systemctl list unit files minus t timer. 10 00:00:32,340 --> 00:00:36,360 And there we can see a couple more systemd timers. 11 00:00:36,360 --> 00:00:39,240 So here we see fstrim.timer fringes. 12 00:00:39,240 --> 00:00:41,850 It's disabled... disabled. That doesn't matter. 13 00:00:41,850 --> 00:00:44,760 We are going to investigate how it works. 14 00:00:44,760 --> 00:00:47,340 I am going to use 15 00:00:47,340 --> 00:00:48,880 systemctl 16 00:00:51,210 --> 00:00:54,780 list unit files 17 00:00:54,780 --> 00:00:56,180 Fstrim *. 18 00:00:57,870 --> 00:00:59,310 And there we can see that we have 19 00:00:59,310 --> 00:01:03,150 an fstrim timer and we have an fstrim service. 20 00:01:03,150 --> 00:01:04,440 Now this is the first thing that you 21 00:01:04,440 --> 00:01:06,930 need to know about systemd timers. 22 00:01:06,930 --> 00:01:09,900 You have something dot timer, and something dot timer 23 00:01:09,900 --> 00:01:12,540 needs something dot service, because the timer is 24 00:01:12,540 --> 00:01:14,340 the modifier to the service. 25 00:01:14,340 --> 00:01:17,370 The service is what you normally do... use to start 26 00:01:17,370 --> 00:01:19,710 your service, and the timer is 27 00:01:19,710 --> 00:01:22,080 how you can apply a timer to it. 28 00:01:22,080 --> 00:01:24,009 Now if you sudo 29 00:01:24,009 --> 00:01:24,842 systemctl 30 00:01:25,890 --> 00:01:26,723 cat 31 00:01:26,723 --> 00:01:29,253 on fstrim.timer, 32 00:01:31,890 --> 00:01:34,860 now we can see what it is doing. 33 00:01:34,860 --> 00:01:37,920 So we have the unit section, and most importantly 34 00:01:37,920 --> 00:01:39,300 we have the timer section. 35 00:01:39,300 --> 00:01:41,760 And in the timer section, we have this OnCalender, 36 00:01:41,760 --> 00:01:42,840 it's weekly, 37 00:01:42,840 --> 00:01:45,420 and AccuracySec and the position is true 38 00:01:45,420 --> 00:01:47,536 and the RandomizedDelay is 6000. 39 00:01:47,536 --> 00:01:49,470 Now the only thing that really matters is 40 00:01:49,470 --> 00:01:52,590 the OnCalender is weekly. That means that systemd 41 00:01:52,590 --> 00:01:53,423 is going to make sure that this timer is going 42 00:01:53,423 --> 00:01:56,580 to run weekly. 43 00:01:56,580 --> 00:01:59,010 But what exactly is it going to run? 44 00:01:59,010 --> 00:02:01,380 Well, the corresponding service. 45 00:02:01,380 --> 00:02:03,210 That is how timers are using. 46 00:02:03,210 --> 00:02:06,660 Whatever dot timer is looking for, whatever dot service. 47 00:02:06,660 --> 00:02:09,120 And when the moment has come that this timer 48 00:02:09,120 --> 00:02:13,890 is going to be activated, it will run fstrim.service. 49 00:02:13,890 --> 00:02:17,580 And that's all that you need to know about timers for now. 50 00:02:17,580 --> 00:02:20,280 Once you get deeper in the Linux operating system, 51 00:02:20,280 --> 00:02:22,410 you will learn how to create your own timers 52 00:02:22,410 --> 00:02:23,918 and what exactly to do in there. 53 00:02:23,918 --> 00:02:27,303 But for now, understanding them is enough.