Debian Codegraph @

man/systemd-socket-activate.xml

raw
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
5
6 <refentry id="systemd-socket-activate"
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8
9 <refentryinfo>
10 <title>systemd-socket-activate</title>
11 <productname>systemd</productname>
12 </refentryinfo>
13
14 <refmeta>
15 <refentrytitle>systemd-socket-activate</refentrytitle>
16 <manvolnum>1</manvolnum>
17 </refmeta>
18
19 <refnamediv>
20 <refname>systemd-socket-activate</refname>
21 <refpurpose>Test socket activation of daemons</refpurpose>
22 </refnamediv>
23
24 <refsynopsisdiv>
25 <cmdsynopsis>
26 <command>systemd-socket-activate</command>
27 <arg choice="opt" rep="repeat">OPTIONS</arg>
28 <arg choice="plain"><replaceable>COMMAND</replaceable>
29 <arg choice="opt" rep="repeat">ARGS</arg>
30 </arg>
31 </cmdsynopsis>
32 </refsynopsisdiv>
33
34 <refsect1>
35 <title>Description</title>
36
37 <para><command>systemd-socket-activate</command> may be used to launch a socket-activated service program from the
38 command line for testing purposes. It may also be used to launch individual instances of the service program per
39 connection.
40 </para>
41
42 <para>The daemon to launch and its options should be specified
43 after options intended for <command>systemd-socket-activate</command>.
44 </para>
45
46 <para>If the <option>--inetd</option> option is given, the socket file descriptor will be used as the standard
47 input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will
48 be passed through file descriptors 3 and higher. Sockets passed through <varname>$LISTEN_FDS</varname> to
49 <command>systemd-socket-activate</command> will be passed through to the daemon, in the original positions. Other sockets
50 specified with <option>--listen=</option> will use consecutive descriptors. By default,
51 <command>systemd-socket-activate</command> listens on a stream socket, use <option>--datagram</option> and
52 <option>--seqpacket</option> to listen on datagram or sequential packet sockets instead (see below).
53 </para>
54 </refsect1>
55
56 <refsect1>
57 <title>Options</title>
58 <variablelist>
59 <varlistentry>
60 <term><option>-l <replaceable>address</replaceable></option></term>
61 <term><option>--listen=<replaceable>address</replaceable></option></term>
62
63 <listitem><para>Listen on this <replaceable>address</replaceable>.
64 Takes a string like <literal>2000</literal> or
65 <literal>127.0.0.1:2001</literal>.</para>
66
67 <xi:include href="version-info.xml" xpointer="v230"/>
68 </listitem>
69 </varlistentry>
70
71 <varlistentry>
72 <term><option>-a</option></term>
73 <term><option>--accept</option></term>
74
75 <listitem><para>Launch an instance of the service program for each connection and pass the connection
76 socket. May not be combined with <option>--now</option>.</para>
77
78 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
79 </varlistentry>
80
81 <varlistentry>
82 <term><option>-d</option></term>
83 <term><option>--datagram</option></term>
84
85 <listitem><para>Listen on a datagram socket (<constant>SOCK_DGRAM</constant>), instead of a stream socket
86 (<constant>SOCK_STREAM</constant>). May not be combined with <option>--seqpacket</option>.</para>
87
88 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
89 </varlistentry>
90
91 <varlistentry>
92 <term><option>--seqpacket</option></term>
93
94 <listitem><para>Listen on a sequential packet socket (<constant>SOCK_SEQPACKET</constant>), instead of a stream
95 socket (<constant>SOCK_STREAM</constant>). May not be combined with
96 <option>--datagram</option>.</para>
97
98 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
99 </varlistentry>
100
101 <varlistentry>
102 <term><option>--inetd</option></term>
103
104 <listitem><para>Use the inetd protocol for passing file descriptors, i.e. as standard input and standard
105 output, instead of the new-style protocol for passing file descriptors using <varname>$LISTEN_FDS</varname>
106 (see above).</para>
107
108 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
109 </varlistentry>
110
111 <varlistentry>
112 <term><option>-E <replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
113 <term><option>--setenv=<replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
114
115 <listitem><para>Add this variable to the environment of the
116 launched process. If <replaceable>VAR</replaceable> is
117 followed by <literal>=</literal>, assume that it is a
118 variable–value pair. Otherwise, obtain the value from the
119 environment of <command>systemd-socket-activate</command> itself.
120 </para>
121
122 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
123 </varlistentry>
124
125 <varlistentry>
126 <term><option>--fdname=<replaceable>NAME</replaceable><optional>:<replaceable>NAME</replaceable>…</optional></option></term>
127
128 <listitem><para>Specify names for the file descriptors passed. This is equivalent to setting
129 <varname>FileDescriptorName=</varname> in socket unit files, and enables use of
130 <citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
131 Multiple entries may be specifies using separate options or by separating names with colons
132 (<literal>:</literal>) in one option. In case more names are given than descriptors, superfluous ones will be
133 ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed.
134 </para>
135
136 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
137 </varlistentry>
138
139 <varlistentry>
140 <term><option>--now</option></term>
141
142 <listitem><para>Start the service program instantly, instead of waiting for a connection on the
143 socket(s). May not be combined with <option>--accept</option>.
144 </para>
145
146 <xi:include href="version-info.xml" xpointer="v258"/></listitem>
147 </varlistentry>
148
149 <xi:include href="standard-options.xml" xpointer="help" />
150 <xi:include href="standard-options.xml" xpointer="version" />
151 </variablelist>
152 </refsect1>
153
154 <refsect1>
155 <title>Environment variables</title>
156 <variablelist class='environment-variables'>
157 <varlistentry>
158 <term><varname>$LISTEN_FDS</varname></term>
159 <term><varname>$LISTEN_PID</varname></term>
160 <term><varname>$LISTEN_PIDFDID</varname></term>
161 <term><varname>$LISTEN_FDNAMES</varname></term>
162
163 <listitem><para>See
164 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
165
166 <xi:include href="version-info.xml" xpointer="v230"/></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_TIME</varname></term>
173 <term><varname>$SYSTEMD_LOG_COLOR</varname></term>
174 <term><varname>$SYSTEMD_LOG_LOCATION</varname></term>
175
176 <listitem><para>Same as in
177 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
178
179 <xi:include href="version-info.xml" xpointer="v230"/></listitem>
180 </varlistentry>
181 </variablelist>
182 </refsect1>
183
184 <refsect1>
185 <title>Examples</title>
186
187 <example>
188 <title>Run an echo server on port 2000</title>
189
190 <programlisting>$ systemd-socket-activate -l 2000 --inetd -a cat</programlisting>
191 </example>
192
193 <example>
194 <title>Run a socket-activated instance of <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
195
196 <programlisting>$ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd</programlisting>
197 </example>
198 </refsect1>
199
200 <refsect1>
201 <title>See Also</title>
202 <para><simplelist type="inline">
203 <member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
204 <member><citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
205 <member><citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry></member>
206 <member><citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
207 <member><citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
208 <member><citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry></member>
209 <member><citerefentry project='man-pages'><refentrytitle>cat</refentrytitle><manvolnum>1</manvolnum></citerefentry></member>
210 </simplelist></para>
211 </refsect1>
212 </refentry>