All right.
So what are we going to need?
Well, to start with, I need to go to etc systemd system
because I'm going to create custom configuration.
So a lab service that is going to sleep and a lab path that
is going to trigger the lab service.
In order to do so, I'm going to copy from user lib systemd
system the CUPS path.
There's a CUPS path, and I want to have that in here,
and I'm calling it lab.path.
I like to work from an example.
And let me also copy the vsftpd.service to here,
and I'm calling it lab.service.
Now, these are just placeholders,
but I like to work from an example
because then I don't get lost in the structure.
So first, I'm taking care of my lab.service.
And in the lab.service, we have the unit description.
And the unit is lab sleeper.
And after, I don't need any after.
The type is simple.
And we are forking, but the easiest one is simple.
And the exec start is user bin sleep 600.
And we don't need an install section
because that is what the path is going to take care of.
Good.
Now, we are going to edit the lab.path.
And in lab.path, description is sleeper path.
Why do I do uppercase?
No specific reason.
It's part of lab.service.
And we want it to trigger when path exists.
And what is the path?
Well, the path is tmp check file.
And install wanted bias multi-user target.
Yeah, that is OK.
So this should be doing it.
So I'm going to use systemctl enable minus minus now
on lab.path.
And I'm using systemctl status on lab.service.
And we can see it is loaded, inactive, and triggered by.
And now, I'm going to use touch on slash tmp check file.
And I do my status on the lab.service again.
And as you can see, it has been triggered.
And that is how path units are working.
Pretty cool, isn't it?