Systemd Declaring a Service Dependency: Difference between revisions
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
=Overview= | =Overview= | ||
This example shows how to declare a dependency between httpd and network services - the system should not attempt to start httpd unless the network service are started, otherwise httpd won't find the network interfaces to bind to. | This example shows how to declare a dependency between httpd and network services - the system should not attempt to start httpd unless the network service are started, otherwise httpd won't find the network interfaces to bind to. For more details on concepts behind dependencies, see: | ||
{{Internal|[[Systemd_Concepts#Dependencies|systemd dependencies}} | |||
=Procedure= | =Procedure= |
Revision as of 09:22, 17 April 2017
Internal
Overview
This example shows how to declare a dependency between httpd and network services - the system should not attempt to start httpd unless the network service are started, otherwise httpd won't find the network interfaces to bind to. For more details on concepts behind dependencies, see:
{{Internal|[[Systemd_Concepts#Dependencies|systemd dependencies}}
Procedure
Create a httpd systemd service configuration directory
/etc/systemd/system/httpd.service.d
Create a httpd systemd service configuration file that expresses the dependency
Create a /etc/systemd/system/httpd.service.d/http-extra.conf file with the following content:
[Unit] Requires=network-online.target After=network-online.target
For more details on the structure of a systemd unit file, see the [Unit] section of a unit file.