Table of Contents

Ubuntu - SystemD - Conflicting Services

When two services should not run at the same time, you can use the Conflicts parameter.


Example

To stop a VPN running when using the Transmission service.

Edit the transmission-daemon.service.

sudo vi /lib/systemd/system/transmission-daemon.service

…add the following line in the [Unit] section:

Conflicts=vpn.service

NOTE: vpn.service could be a service that starts a VPN connection.

  • This means that if I start the transmission-daemon.service, vpnservice will be automatically shut down, and vice versa.

Reload systemd

Reload systemd for the changes to take effect.

sudo systemctl daemon-reload