On Fri, 2014-11-21 at 13:52 +0400, Peter Lemenkov wrote:
> 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.


I'm not an expert on the matter, but in general I think usually the
bar.service has to be modified such that it *automatically* exits when
it's not in use. Then systemd will autostart it whenever the socket is
opened and then after some reasonable wait-time, the service will exit
until the next time it's auto-started.

Attachment: signature.asc
Description: This is a digitally signed message part

-- 
devel mailing list
devel@lists.fedoraproject.org
https://admin.fedoraproject.org/mailman/listinfo/devel
Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct

Reply via email to