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