I have the following service configuration :
$ systemctl cat bluetooth
# /lib/systemd/system/bluetooth.service
[Unit]
Description=Bluetooth service
Documentation=man:bluetoothd(8)
ConditionPathIsDirectory=/sys/class/bluetooth
[Service]
Type=dbus
BusName=org.bluez
ExecStart=/usr/lib/bluetooth/bluetoothd
NotifyAccess=main
#WatchdogSec=10
#Restart=on-failure
CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
LimitNPROC=1
#RestartSec=5
[Install]
WantedBy=bluetooth.target suspend.target
Alias=dbus-org.bluez.service
I added the suspend.target in the WantedBy= parameter of the [Install] section (man systemd.unit) for the service to be restarted upon resume but this does not work.
EDIT0 : The service is not stopped at suspend but it needs to be restarted after resume because this service does not support suspend/resume operation on my configuration.
EDIT1 : The suspend.target should also work because according to man systemd.special :
suspend.target A special target unit for suspending the system. This pulls in sleep.target.
EDIT2 : It seems that the command sudo systemctl edit --full bluetooth created another copy of the bluetooth.service in /etc/systemd/system/bluetooth.service which became different (from /lib/systemd/system/bluetooth.service) once the file was saved.
I've just noticed I had two different versions of bluetooth.service so I was a little confused.
How to restart a systemd service upon resume ?