Systemd unit file implementation questions (ypbind)

"Jóhann B. Guðmundsson" johannbg at gmail.com
Thu Apr 14 14:57:52 UTC 2011


On 04/14/2011 02:35 PM, Michal Hlavinka wrote:
> If I use Requires= directive, it starts driver for upsd, but is it possible to specify to
> stop the driver when upsd stops?
>

I think that you would use BindTo= instead of Requires= in upsd.service 
( that is if uspd is depend upon them being running = ) along with ExecStop=

In man systemd.unit

  BindTo=
            Configures requirement dependencies, very similar in style 
to Requires=, however in addition to this behaviour it also
            declares that this unit is stopped when any of the units 
listed suddenly disappears. Units can suddenly, unexpectedly
            disappear if a service terminates on its own choice, a 
device is unplugged or a mount point unmounted without involvement of
            systemd.

ExecStop=-/bin/systemctl stop upsd-device.service
ExecStop=-/bin/systemctl stop upsd-monitor.service


JBG


More information about the devel mailing list