]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-socket-activate.xml
final v236 update (#7649)
[thirdparty/systemd.git] / man / systemd-socket-activate.xml
CommitLineData
3802a3d3 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2ca0435b 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
2ca0435b
ZJS
4
5<!--
572eb058
ZJS
6 SPDX-License-Identifier: LGPL-2.1+
7
b975b0d5 8 This file is part of systemd.
2ca0435b 9
b975b0d5 10 Copyright 2013 Zbigniew Jędrzejewski-Szmek
2ca0435b 11
b975b0d5
ZJS
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.
2ca0435b 16
b975b0d5
ZJS
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.
2ca0435b 21
b975b0d5
ZJS
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/>.
2ca0435b
ZJS
24-->
25
7f6e8043 26<refentry id="systemd-socket-activate"
dfdebb1b 27 xmlns:xi="http://www.w3.org/2001/XInclude">
2ca0435b
ZJS
28
29 <refentryinfo>
7f6e8043 30 <title>systemd-socket-activate</title>
2ca0435b
ZJS
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>
7f6e8043
ZJS
44 <refentrytitle>systemd-socket-activate</refentrytitle>
45 <manvolnum>1</manvolnum>
2ca0435b
ZJS
46 </refmeta>
47
48 <refnamediv>
7f6e8043 49 <refname>systemd-socket-activate</refname>
2ca0435b
ZJS
50 <refpurpose>Test socket activation of daemons</refpurpose>
51 </refnamediv>
52
53 <refsynopsisdiv>
54 <cmdsynopsis>
7f6e8043 55 <command>systemd-socket-activate</command>
2ca0435b
ZJS
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
7f6e8043 65 <para><command>systemd-socket-activate</command> may be used to launch a socket-activated service binary from the command
eef0a274 66 line for testing purposes. It may also be used to launch individual instances of the service binary per connection.
2ca0435b
ZJS
67 </para>
68
ff9b60f3 69 <para>The daemon to launch and its options should be specified
7f6e8043 70 after options intended for <command>systemd-socket-activate</command>.
2ca0435b
ZJS
71 </para>
72
eef0a274
LP
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
7f6e8043 76 <command>systemd-socket-activate</command> will be passed through to the daemon, in the original positions. Other sockets
eef0a274 77 specified with <option>--listen=</option> will use consecutive descriptors. By default,
7f6e8043 78 <command>systemd-socket-activate</command> listens on a stream socket, use <option>--datagram</option> and
eef0a274 79 <option>--seqpacket</option> to listen on datagram or sequential packet sockets instead (see below).
2ca0435b
ZJS
80 </para>
81 </refsect1>
82
83 <refsect1>
84 <title>Options</title>
85 <variablelist>
2ca0435b 86 <varlistentry>
5e65c93a 87 <term><option>-l <replaceable>address</replaceable></option></term>
2ca0435b
ZJS
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
eef0a274
LP
100 <listitem><para>Launch an instance of the service binary for each connection and pass the connection
101 socket.</para></listitem>
2ca0435b 102 </varlistentry>
5e65c93a 103
530a071a
SS
104 <varlistentry>
105 <term><option>-d</option></term>
106 <term><option>--datagram</option></term>
107
d31e430f
LP
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>
530a071a
SS
118 </varlistentry>
119
eef0a274
LP
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
5e65c93a
ZJS
128 <varlistentry>
129 <term><option>-E <replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
892213bf 130 <term><option>--setenv=<replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
5e65c93a
ZJS
131
132 <listitem><para>Add this variable to the environment of the
133 launched process. If <replaceable>VAR</replaceable> is
79640424
JE
134 followed by <literal>=</literal>, assume that it is a
135 variable–value pair. Otherwise, obtain the value from the
7f6e8043 136 environment of <command>systemd-socket-activate</command> itself.
5e65c93a
ZJS
137 </para></listitem>
138 </varlistentry>
dfdebb1b 139
8dd4c05b 140 <varlistentry>
1eecafb8 141 <term><option>--fdname=</option><replaceable>NAME</replaceable><optional>:<replaceable>NAME</replaceable>…</optional></term>
cf98937c
ZJS
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
b17649ee 147 (<literal>:</literal>) in one option. In case more names are given than descriptors, superfluous ones will be
cf98937c
ZJS
148 ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed.
149 </para></listitem>
8dd4c05b
LP
150 </varlistentry>
151
dfdebb1b
ZJS
152 <xi:include href="standard-options.xml" xpointer="help" />
153 <xi:include href="standard-options.xml" xpointer="version" />
2ca0435b
ZJS
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>
8dd4c05b 163 <term><varname>$LISTEN_FDNAMES</varname></term>
2ca0435b 164
1446560f
ZJS
165 <listitem><para>See
166 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
2ca0435b
ZJS
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
1446560f
ZJS
175 <listitem><para>Same as in
176 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para></listitem>
2ca0435b
ZJS
177 </varlistentry>
178 </variablelist>
179 </refsect1>
180
181 <refsect1>
1db8c66f 182 <title>Examples</title>
2ca0435b 183
1db8c66f
RC
184 <example>
185 <title>Run an echo server on port 2000</title>
2ca0435b 186
7f6e8043 187 <programlisting>$ systemd-socket-activate -l 2000 --inetd -a cat</programlisting>
1db8c66f 188 </example>
2ca0435b 189
1db8c66f 190 <example>
b938cb90 191 <title>Run a socket-activated instance of <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
2ca0435b 192
7f6e8043 193 <programlisting>$ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd</programlisting>
1db8c66f 194 </example>
2ca0435b
ZJS
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>,
8dd4c05b
LP
203 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
204 <citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
3ba3a79d 205 <citerefentry project='man-pages'><refentrytitle>cat</refentrytitle><manvolnum>1</manvolnum></citerefentry>
2ca0435b
ZJS
206 </para>
207 </refsect1>
208</refentry>