Re: [systemd-devel] "StopWhenUnneeded"-like option for socket-activated services?
Hi On Thu, Sep 17, 2015 at 1:02 PM, Laércio de Sousa 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 systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] "StopWhenUnneeded"-like option for socket-activated services?
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. 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! -- *Laércio de Sousa* *Orientador de Informática* *Escola Municipal "Professor Eulálio Gruppi"* *Rua Ismael da Silva Mello, 559, Mogi Moderno* *Mogi das Cruzes - SPCEP 08717-390* Telefone: (11) 4726-8313 ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel