I have a question about systemd services dependencies and ordering. I have a service a.service
that wants and must be started before a service b.service
. The target multi-user.target
wants the service a.service
but NOT b.service
. How can I be sure b.service
is started once the target is reached ?
谢谢您的回答
In your
systemd
unit file, within the[Unit]
directive you can haveAfter=
. For example, I have a Node.js script set to run. It needs networking, so the first few lines would look like:This means it will only run after
network.target
andauditd.service
. For your case, you could try to putAfter=a.service
in your unit file forb.service
.Edit: See this answer for more information on
After=
vsRequire=