TransWikia.com

systemctl service + how to configure service for boot priority

Server Fault Asked on December 16, 2021

we have rhel 7.2 machine

server have the following service

[root@server1 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

One 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.

Answered by Michael Hampton on December 16, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP