Systemd Declaring a Service Dependency

From NovaOrdis Knowledge Base
Revision as of 19:57, 11 January 2016 by Ovidiu (talk | contribs)
Jump to navigation Jump to search

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

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:

[Unit] Requires=network-online.target After=network-online.target