systemd: b requires a, stop a if b stops

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

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


Updated January 09, 2019 11:00 AM

Updated July 28, 2019 21:00 PM

Updated August 12, 2015 17:00 PM

Updated July 17, 2018 15:00 PM