Hi

On Thu, Sep 17, 2015 at 1:02 PM, Laércio de Sousa
<[email protected]> wrote:
> Hi there!
>
> I have a curiosity: is there some way to systemd to detect when all
> connections to a given socket are closed, so that the service assigned to
> that socket unit can be automatically stopped (but the socket unit itself
> keeps listening)? Something similar to StopWhenUnneeded option, which makes
> a service stop automatically when its dependants have stopped.

If your service is socket-activated, you should be able to shutdown
via sd_notify(false, "STOPPING=1") on idle. This way, systemd will
restart your unit on the next incoming connection.

Thanks
David

> My practical example: I'm trying new possibilities with my single-GPU
> multi-seat setup (a bare Xorg server spanning all video outputs, on top of
> which a Xephyr instance is started for each output/seat). My current system
> starts a socket-activated systemd service for the bare Xorg when my LightDM
> starts its first Xephyr instance. I would like to stop the bare Xorg service
> when all Xephyr-based seats are removed (e.g. their master devices are
> unplugged or LightDM service is stopped).
>
> Thanks in advance!
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to