I've been trying to configure a service to start / stop whenever a given device appears / disappears, and I came out with the following options:
Then I do a "systemctl enable test.service" and that works perfectly.
But here is the problem: if the device contains escaped characters:
It just half-works: the service is stopped when the device disappears, but it is not started when it later reappears.
After some research, I found that the problem is that the command "systemctl enable test.service" creates the link as:
If then I rename it into:
And it works again.
It looks like the escape rules in the unit file are different for different lines.
Rodrigo Rivas Costa
I think we should not remove escaping from strings in [Install] section, I will attach patch which should resolve the issue, but I'm not 100% sure that it's not gonna break something else.
Created attachment 64541 [details] [review]
Don't remove escaping
This should be fixed in 194 (possibly older). If not, please reopen.
*** Bug 78994 has been marked as a duplicate of this bug. ***
Still here in V212 (I mistakenly opened a new bug for it).
I refreshed the patch and pushed it as http://cgit.freedesktop.org/systemd/systemd/commit/?id=000f6e56.