|
|
9fc0f6 |
From 6fe43c70ac008feaf26f49420c559565e3b50528 Mon Sep 17 00:00:00 2001
|
|
|
9fc0f6 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
|
9fc0f6 |
Date: Mon, 30 Dec 2013 00:11:30 -0500
|
|
|
9fc0f6 |
Subject: [PATCH] man: expand on some more subtle points in systemd.socket(5)
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=727708#1694
|
|
|
9fc0f6 |
---
|
|
|
9fc0f6 |
man/systemd.socket.xml | 67 ++++++++++++++++++++++++++++++++++++--------------
|
|
|
9fc0f6 |
1 file changed, 49 insertions(+), 18 deletions(-)
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
diff --git a/man/systemd.socket.xml b/man/systemd.socket.xml
|
|
|
9fc0f6 |
index ac3127d..570a6fb 100644
|
|
|
9fc0f6 |
--- a/man/systemd.socket.xml
|
|
|
9fc0f6 |
+++ b/man/systemd.socket.xml
|
|
|
9fc0f6 |
@@ -85,21 +85,26 @@
|
|
|
9fc0f6 |
processes of the socket.</para>
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
<para>For each socket file a matching service file
|
|
|
9fc0f6 |
- (see
|
|
|
9fc0f6 |
+ must exist, describing the service to start on
|
|
|
9fc0f6 |
+ incoming traffic on the socket (see
|
|
|
9fc0f6 |
<citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
|
|
|
9fc0f6 |
- for details) must exist, describing the service to
|
|
|
9fc0f6 |
- start on incoming traffic on the socket. Depending on
|
|
|
9fc0f6 |
- the setting of <option>Accept=</option> (see below),
|
|
|
9fc0f6 |
- this must either be named like the socket unit, but
|
|
|
9fc0f6 |
- with the suffix replaced; or it must be a template
|
|
|
9fc0f6 |
- file named the same way. Example: a socket file
|
|
|
9fc0f6 |
+ for more information about .service files). The name
|
|
|
9fc0f6 |
+ of the .service unit is by default the same as the
|
|
|
9fc0f6 |
+ name of the .socket unit, but can be altered with
|
|
|
9fc0f6 |
+ <option>Service=</option> option described below.
|
|
|
9fc0f6 |
+ Depending on the setting of <option>Accept=</option>
|
|
|
9fc0f6 |
+ option described below, this .service unit must either
|
|
|
9fc0f6 |
+ be named like the .socket unit, but with the suffix
|
|
|
9fc0f6 |
+ replaced, unless overridden with
|
|
|
9fc0f6 |
+ <option>Service=</option>; or it must be a template
|
|
|
9fc0f6 |
+ unit named the same way. Example: a socket file
|
|
|
9fc0f6 |
<filename>foo.socket</filename> needs a matching
|
|
|
9fc0f6 |
service <filename>foo.service</filename> if
|
|
|
9fc0f6 |
<option>Accept=false</option> is set. If
|
|
|
9fc0f6 |
- <option>Accept=true</option> is set, a service template
|
|
|
9fc0f6 |
- file <filename>foo@.service</filename> must exist from
|
|
|
9fc0f6 |
- which services are instantiated for each incoming
|
|
|
9fc0f6 |
- connection.</para>
|
|
|
9fc0f6 |
+ <option>Accept=true</option> is set, a service
|
|
|
9fc0f6 |
+ template file <filename>foo@.service</filename> must
|
|
|
9fc0f6 |
+ exist from which services are instantiated for each
|
|
|
9fc0f6 |
+ incoming connection.</para>
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
<para>Unless <varname>DefaultDependencies=</varname>
|
|
|
9fc0f6 |
is set to <option>false</option>, socket units will
|
|
|
9fc0f6 |
@@ -116,9 +121,21 @@
|
|
|
9fc0f6 |
boot or late system shutdown should disable this
|
|
|
9fc0f6 |
option.</para>
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
+ <para>Socket units will have a
|
|
|
9fc0f6 |
+ <varname>Before=</varname> dependency on the service
|
|
|
9fc0f6 |
+ which they trigger added implicitly. No implicit
|
|
|
9fc0f6 |
+ <varname>WantedBy=</varname> or
|
|
|
9fc0f6 |
+ <varname>RequiredBy=</varname> dependency from the
|
|
|
9fc0f6 |
+ socket to the service is added. This means that the
|
|
|
9fc0f6 |
+ service may be started without the socket, in which
|
|
|
9fc0f6 |
+ case it must be able to open sockets by itself. To
|
|
|
9fc0f6 |
+ prevent this, an explicit <varname>Requires=</varname>
|
|
|
9fc0f6 |
+ dependency may be added.</para>
|
|
|
9fc0f6 |
+
|
|
|
9fc0f6 |
<para>Socket units may be used to implement on-demand
|
|
|
9fc0f6 |
starting of services, as well as parallelized starting
|
|
|
9fc0f6 |
- of services.</para>
|
|
|
9fc0f6 |
+ of services. See the blog stories linked at the end
|
|
|
9fc0f6 |
+ for introduction.</para>
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
<para>Note that the daemon software configured for
|
|
|
9fc0f6 |
socket activation with socket units needs to be able
|
|
|
9fc0f6 |
@@ -221,12 +238,23 @@
|
|
|
9fc0f6 |
of any of these options will have no
|
|
|
9fc0f6 |
effect.</para>
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
+ <para>It is also possible to have more
|
|
|
9fc0f6 |
+ than one socket unit for the same
|
|
|
9fc0f6 |
+ service when using
|
|
|
9fc0f6 |
+ <varname>Service=</varname>, and the
|
|
|
9fc0f6 |
+ service will receive all the sockets
|
|
|
9fc0f6 |
+ configured in all the socket units.
|
|
|
9fc0f6 |
+ Sockets configured in one unit are
|
|
|
9fc0f6 |
+ passed in the order of configuration,
|
|
|
9fc0f6 |
+ but no ordering between socket units
|
|
|
9fc0f6 |
+ is specified.</para>
|
|
|
9fc0f6 |
+
|
|
|
9fc0f6 |
<para>If an IP address is used here,
|
|
|
9fc0f6 |
it is often desirable to listen on it
|
|
|
9fc0f6 |
before the interface it is configured
|
|
|
9fc0f6 |
on is up and running, and even
|
|
|
9fc0f6 |
regardless of whether it will be up and
|
|
|
9fc0f6 |
- running ever at all. To deal with this
|
|
|
9fc0f6 |
+ running at any point. To deal with this
|
|
|
9fc0f6 |
it is recommended to set the
|
|
|
9fc0f6 |
<varname>FreeBind=</varname> option
|
|
|
9fc0f6 |
described below.</para></listitem>
|
|
|
9fc0f6 |
@@ -687,11 +715,14 @@
|
|
|
9fc0f6 |
<term><varname>Service=</varname></term>
|
|
|
9fc0f6 |
<listitem><para>Specifies the service
|
|
|
9fc0f6 |
unit name to activate on incoming
|
|
|
9fc0f6 |
- traffic. This defaults to the service
|
|
|
9fc0f6 |
- that bears the same name as the socket
|
|
|
9fc0f6 |
- (ignoring the different suffixes). In
|
|
|
9fc0f6 |
- most cases it should not be necessary
|
|
|
9fc0f6 |
- to use this option.</para></listitem>
|
|
|
9fc0f6 |
+ traffic. This setting is only allowed
|
|
|
9fc0f6 |
+ for sockets with
|
|
|
9fc0f6 |
+ <varname>Accept=no</varname>. It
|
|
|
9fc0f6 |
+ defaults to the service that bears the
|
|
|
9fc0f6 |
+ same name as the socket (with the
|
|
|
9fc0f6 |
+ suffix replaced). In most cases it
|
|
|
9fc0f6 |
+ should not be necessary to use this
|
|
|
9fc0f6 |
+ option.</para></listitem>
|
|
|
9fc0f6 |
</varlistentry>
|
|
|
9fc0f6 |
|
|
|
9fc0f6 |
</variablelist>
|