1
00:00:00,000 --> 00:00:07,280
All right.

2
00:00:07,280 --> 00:00:08,800
So what are we going to need?

3
00:00:08,800 --> 00:00:14,160
Well, to start with, I need to go to etc systemd system

4
00:00:14,160 --> 00:00:17,799
because I'm going to create custom configuration.

5
00:00:17,799 --> 00:00:22,920
So a lab service that is going to sleep and a lab path that

6
00:00:22,920 --> 00:00:26,719
is going to trigger the lab service.

7
00:00:26,719 --> 00:00:32,560
In order to do so, I'm going to copy from user lib systemd

8
00:00:32,560 --> 00:00:38,680
system the CUPS path.

9
00:00:38,680 --> 00:00:42,400
There's a CUPS path, and I want to have that in here,

10
00:00:42,400 --> 00:00:45,200
and I'm calling it lab.path.

11
00:00:45,200 --> 00:00:47,400
I like to work from an example.

12
00:00:47,400 --> 00:00:54,119
And let me also copy the vsftpd.service to here,

13
00:00:54,119 --> 00:00:57,759
and I'm calling it lab.service.

14
00:00:57,759 --> 00:00:59,320
Now, these are just placeholders,

15
00:00:59,320 --> 00:01:01,720
but I like to work from an example

16
00:01:01,720 --> 00:01:04,440
because then I don't get lost in the structure.

17
00:01:04,440 --> 00:01:07,559
So first, I'm taking care of my lab.service.

18
00:01:07,559 --> 00:01:11,519
And in the lab.service, we have the unit description.

19
00:01:11,519 --> 00:01:15,839
And the unit is lab sleeper.

20
00:01:15,839 --> 00:01:18,680
And after, I don't need any after.

21
00:01:18,680 --> 00:01:21,320
The type is simple.

22
00:01:21,320 --> 00:01:25,120
And we are forking, but the easiest one is simple.

23
00:01:25,120 --> 00:01:36,120
And the exec start is user bin sleep 600.

24
00:01:36,120 --> 00:01:38,120
And we don't need an install section

25
00:01:38,120 --> 00:01:42,599
because that is what the path is going to take care of.

26
00:01:42,599 --> 00:01:43,360
Good.

27
00:01:43,360 --> 00:01:46,919
Now, we are going to edit the lab.path.

28
00:01:46,919 --> 00:01:56,320
And in lab.path, description is sleeper path.

29
00:01:56,320 --> 00:01:57,599
Why do I do uppercase?

30
00:01:57,599 --> 00:01:59,360
No specific reason.

31
00:01:59,360 --> 00:02:02,519
It's part of lab.service.

32
00:02:02,519 --> 00:02:07,160
And we want it to trigger when path exists.

33
00:02:07,160 --> 00:02:08,320
And what is the path?

34
00:02:08,320 --> 00:02:14,240
Well, the path is tmp check file.

35
00:02:14,240 --> 00:02:16,839
And install wanted bias multi-user target.

36
00:02:16,839 --> 00:02:18,240
Yeah, that is OK.

37
00:02:18,240 --> 00:02:21,000
So this should be doing it.

38
00:02:21,000 --> 00:02:24,759
So I'm going to use systemctl enable minus minus now

39
00:02:24,759 --> 00:02:26,720
on lab.path.

40
00:02:26,720 --> 00:02:32,919
And I'm using systemctl status on lab.service.

41
00:02:32,919 --> 00:02:37,000
And we can see it is loaded, inactive, and triggered by.

42
00:02:37,000 --> 00:02:42,919
And now, I'm going to use touch on slash tmp check file.

43
00:02:42,919 --> 00:02:46,360
And I do my status on the lab.service again.

44
00:02:46,360 --> 00:02:48,520
And as you can see, it has been triggered.

45
00:02:48,520 --> 00:02:51,279
And that is how path units are working.

46
00:02:51,279 --> 00:02:53,839
Pretty cool, isn't it?

