How to stop unneeded services?

Peter Lemenkov lemenkov at gmail.com
Fri Nov 21 09:52:06 UTC 2014


Hello All!
Perhaps a silly question but I'm stuck and need your help, my fellow fedorians.

I've got a service foo.service which Requires=bar.socket (which in
turn runs bar.service). So if I start foo.service then systemd opens
bar.socket, captures first packet and runs bar.service (which isn't
intended to be started manually btw). So far everything works as
expected.

I was asked if it's possible to automatically stop bar.service (and
bar.socket) if no services which requires these two are active. I
played with StopWhenUnneeded +
BindsTo but without much success.

I believe this sounds like a generic pattern so perhaps someone
already implemented it. Could somebody point me on working example?
Any other help would be greatly appreciated.

-- 
With best regards, Peter Lemenkov.


More information about the devel mailing list