systemctl service + how to configure service for boot priority

King David asked:

we have rhel 7.2 machine

server have the following service

[[email protected] system]# more rc_build_infra.service
[Unit]
Description=infra Manager Server
Requires=network.target remote-fs.target
After=network.target remote-fs.target

[Service]
Restart=on-failure
StartLimitInterval=5min
StartLimitBurst=4
LimitMEMLOCK=infinity
LimitNOFILE=65535
Type=simple
User=infra_bb
Group=mc_group
Environment=JAVA_HOME=/usr/bin/java
ExecStart=/opt/infra_start.sh

[Install]
WantedBy=multi-user.target

now I want to build the a similar service but the new service should be execute after – rc_build_infra.service

what are the configuration that should be in the new service

so new service will execute during machine boot after – rc_build_infra.service

My answer:


That is simple. You would just use After= in the [Unit] section to declare your desired service order. You can see that your existing unit already does this.

Depending on the nature of the dependencies between your services, you may also need to declare Requires= or BindsTo=. See the documentation for their semantics and you will be able to determine if your scenario requires either of these.


View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.