I have the following myweb.service file[Unit]Description=myweb - A simple hello world programAfter=bluetooth.service[Service]Type=simpleUser=rootExecStart=/usr/bin/docker run -p 2222:4343 manikanth/webappRestart=on-failure[Install]#WantedBy=multi-user.targetI purposefully disabled bluetooth.service and checked. But still the service becomes active. I thought it could be due to WantedBy and hence I commented it. The problem persists stillWhat's the right way not to bring up the service if the dependent service e.g. bluetooth.service is not active?
systemd After [unit] option not working
linux;ubuntu;systemd;init
You are probably looking for the Requisite= option along with the After= option.From the man pageSimilar to Requires=. However, if the units listed here are not started already, they will not be started and the transaction will fail immediately. Requires= does not work in this case is because the bluetooth.service will be started when you start myweb.service. Requisite= option will not attempt to start the bluetooth.service. However, it will show the myweb.service as failed.