systemd: b requires a, stop a if b stops

by Marki   Last Updated September 11, 2019 16:00 PM - source

This is b.service:

[Unit]
Description=b.service
ConditionPathExists=/usr/sbin/b
Requires=a.service
BindsTo=a.service
After=a.service

[Service]
ExecStart=/usr/sbin/b

This does almost all I want:

  • If b.service starts, then a.service starts.
  • If a.service starts, then b.service starts.
  • If a.service stops, then b.service stops.

I would like to add the remaining dependency: if b.service stops, then a.service stops, without modifying the service file of a.service, if possible.

Tags : systemd


Related Questions