Systemd Declaring a Service Dependency: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
No edit summary
No edit summary
Line 15: Line 15:
</pre>
</pre>


2. Create a file, the name could be 'http-extra.conf' (/etc/systemd/system/httpd.service.d/http-extra.conf) and the content should be:
==Create a httpd systemd service configuration file that expresses the dependency==


Create a <tt>/etc/systemd/system/httpd.service.d/http-extra.conf</tt> file with the following content:
<pre>
[Unit]
[Unit]
Requires=network-online.target
Requires=network-online.target
After=network-online.target
After=network-online.target
<pre>

Revision as of 20:04, 11 January 2016

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.

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