]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd-socket-activate.xml
final v236 update (#7649)
[thirdparty/systemd.git] / man / systemd-socket-activate.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 SPDX-License-Identifier: LGPL-2.1+
7
8 This file is part of systemd.
9
10 Copyright 2013 Zbigniew Jędrzejewski-Szmek
11
12 systemd is free software; you can redistribute it and/or modify it
13 under the terms of the GNU Lesser General Public License as published by
14 the Free Software Foundation; either version 2.1 of the License, or
15 (at your option) any later version.
16
17 systemd is distributed in the hope that it will be useful, but
18 WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 Lesser General Public License for more details.
21
22 You should have received a copy of the GNU Lesser General Public License
23 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 -->
25
26 <refentry id="systemd-socket-activate"
27 xmlns:xi="http://www.w3.org/2001/XInclude">
28
29 <refentryinfo>
30 <title>systemd-socket-activate</title>
31 <productname>systemd</productname>
32
33 <authorgroup>
34 <author>
35 <contrib>Developer</contrib>
36 <firstname>Zbigniew</firstname>
37 <surname>Jędrzejewski-Szmek</surname>
38 <email>zbyszek@in.waw.pl</email>
39 </author>
40 </authorgroup>
41 </refentryinfo>
42
43 <refmeta>
44 <refentrytitle>systemd-socket-activate</refentrytitle>
45 <manvolnum>1</manvolnum>
46 </refmeta>
47
48 <refnamediv>
49 <refname>systemd-socket-activate</refname>
50 <refpurpose>Test socket activation of daemons</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <cmdsynopsis>
55 <command>systemd-socket-activate</command>
56 <arg choice="opt" rep="repeat">OPTIONS</arg>
57 <arg choice="plain"><replaceable>daemon</replaceable></arg>
58 <arg choice="opt" rep="repeat">OPTIONS</arg>
59 </cmdsynopsis>
60 </refsynopsisdiv>
61
62 <refsect1>
63 <title>Description</title>
64
65 <para><command>systemd-socket-activate</command> may be used to launch a socket-activated service binary from the command
66 line for testing purposes. It may also be used to launch individual instances of the service binary per connection.
67 </para>
68
69 <para>The daemon to launch and its options should be specified
70 after options intended for <command>systemd-socket-activate</command>.
71 </para>
72
73 <para>If the <option>--inetd</option> option is given, the socket file descriptor will be used as the standard
74 input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will
75 be passed through file descriptors 3 and higher. Sockets passed through <varname>$LISTEN_FDS</varname> to
76 <command>systemd-socket-activate</command> will be passed through to the daemon, in the original positions. Other sockets
77 specified with <option>--listen=</option> will use consecutive descriptors. By default,
78 <command>systemd-socket-activate</command> listens on a stream socket, use <option>--datagram</option> and
79 <option>--seqpacket</option> to listen on datagram or sequential packet sockets instead (see below).
80 </para>
81 </refsect1>
82
83 <refsect1>
84 <title>Options</title>
85 <variablelist>
86 <varlistentry>
87 <term><option>-l <replaceable>address</replaceable></option></term>
88 <term><option>--listen=<replaceable>address</replaceable></option></term>
89
90 <listitem><para>Listen on this <replaceable>address</replaceable>.
91 Takes a string like <literal>2000</literal> or
92 <literal>127.0.0.1:2001</literal>.</para>
93 </listitem>
94 </varlistentry>
95
96 <varlistentry>
97 <term><option>-a</option></term>
98 <term><option>--accept</option></term>
99
100 <listitem><para>Launch an instance of the service binary for each connection and pass the connection
101 socket.</para></listitem>
102 </varlistentry>
103
104 <varlistentry>
105 <term><option>-d</option></term>
106 <term><option>--datagram</option></term>
107
108 <listitem><para>Listen on a datagram socket (<constant>SOCK_DGRAM</constant>), instead of a stream socket
109 (<constant>SOCK_STREAM</constant>). May not be combined with <option>--seqpacket</option>.</para></listitem>
110 </varlistentry>
111
112 <varlistentry>
113 <term><option>--seqpacket</option></term>
114
115 <listitem><para>Listen on a sequential packet socket (<constant>SOCK_SEQPACKET</constant>), instead of a stream
116 socket (<constant>SOCK_STREAM</constant>). May not be combined with
117 <option>--datagram</option>.</para></listitem>
118 </varlistentry>
119
120 <varlistentry>
121 <term><option>--inetd</option></term>
122
123 <listitem><para>Use the inetd protocol for passing file descriptors, i.e. as standard input and standard
124 output, instead of the new-style protocol for passing file descriptors using <varname>$LISTEN_FDS</varname>
125 (see above).</para></listitem>
126 </varlistentry>
127
128 <varlistentry>
129 <term><option>-E <replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
130 <term><option>--setenv=<replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
131
132 <listitem><para>Add this variable to the environment of the
133 launched process. If <replaceable>VAR</replaceable> is
134 followed by <literal>=</literal>, assume that it is a
135 variable–value pair. Otherwise, obtain the value from the
136 environment of <command>systemd-socket-activate</command> itself.
137 </para></listitem>
138 </varlistentry>
139
140 <varlistentry>
141 <term><option>--fdname=</option><replaceable>NAME</replaceable><optional>:<replaceable>NAME</replaceable></optional></term>
142
143 <listitem><para>Specify names for the file descriptors passed. This is equivalent to setting
144 <varname>FileDescriptorName=</varname> in socket unit files, and enables use of
145 <citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
146 Multiple entries may be specifies using separate options or by separating names with colons
147 (<literal>:</literal>) in one option. In case more names are given than descriptors, superfluous ones will be
148 ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed.
149 </para></listitem>
150 </varlistentry>
151
152 <xi:include href="standard-options.xml" xpointer="help" />
153 <xi:include href="standard-options.xml" xpointer="version" />
154 </variablelist>
155 </refsect1>
156
157 <refsect1>
158 <title>Environment variables</title>
159 <variablelist class='environment-variables'>
160 <varlistentry>
161 <term><varname>$LISTEN_FDS</varname></term>
162 <term><varname>$LISTEN_PID</varname></term>
163 <term><varname>$LISTEN_FDNAMES</varname></term>
164
165 <listitem><para>See
166 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
167 </varlistentry>
168
169 <varlistentry>
170 <term><varname>$SYSTEMD_LOG_TARGET</varname></term>
171 <term><varname>$SYSTEMD_LOG_LEVEL</varname></term>
172 <term><varname>$SYSTEMD_LOG_COLOR</varname></term>
173 <term><varname>$SYSTEMD_LOG_LOCATION</varname></term>
174
175 <listitem><para>Same as in
176 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para></listitem>
177 </varlistentry>
178 </variablelist>
179 </refsect1>
180
181 <refsect1>
182 <title>Examples</title>
183
184 <example>
185 <title>Run an echo server on port 2000</title>
186
187 <programlisting>$ systemd-socket-activate -l 2000 --inetd -a cat</programlisting>
188 </example>
189
190 <example>
191 <title>Run a socket-activated instance of <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
192
193 <programlisting>$ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd</programlisting>
194 </example>
195 </refsect1>
196
197 <refsect1>
198 <title>See Also</title>
199 <para>
200 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
201 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
202 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
203 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
204 <citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
205 <citerefentry project='man-pages'><refentrytitle>cat</refentrytitle><manvolnum>1</manvolnum></citerefentry>
206 </para>
207 </refsect1>
208 </refentry>