]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd-socket-activate.xml
verify: use manager_load_startable_unit_or_warn() to load units for verification
[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
3f2d1365
AJ
65 <para><command>systemd-socket-activate</command> may be used to launch a socket-activated service program from the
66 command line for testing purposes. It may also be used to launch individual instances of the service program per
67 connection.
2ca0435b
ZJS
68 </para>
69
ff9b60f3 70 <para>The daemon to launch and its options should be specified
7f6e8043 71 after options intended for <command>systemd-socket-activate</command>.
2ca0435b
ZJS
72 </para>
73
eef0a274
LP
74 <para>If the <option>--inetd</option> option is given, the socket file descriptor will be used as the standard
75 input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will
76 be passed through file descriptors 3 and higher. Sockets passed through <varname>$LISTEN_FDS</varname> to
7f6e8043 77 <command>systemd-socket-activate</command> will be passed through to the daemon, in the original positions. Other sockets
eef0a274 78 specified with <option>--listen=</option> will use consecutive descriptors. By default,
7f6e8043 79 <command>systemd-socket-activate</command> listens on a stream socket, use <option>--datagram</option> and
eef0a274 80 <option>--seqpacket</option> to listen on datagram or sequential packet sockets instead (see below).
2ca0435b
ZJS
81 </para>
82 </refsect1>
83
84 <refsect1>
85 <title>Options</title>
86 <variablelist>
2ca0435b 87 <varlistentry>
5e65c93a 88 <term><option>-l <replaceable>address</replaceable></option></term>
2ca0435b
ZJS
89 <term><option>--listen=<replaceable>address</replaceable></option></term>
90
91 <listitem><para>Listen on this <replaceable>address</replaceable>.
92 Takes a string like <literal>2000</literal> or
93 <literal>127.0.0.1:2001</literal>.</para>
94 </listitem>
95 </varlistentry>
96
97 <varlistentry>
98 <term><option>-a</option></term>
99 <term><option>--accept</option></term>
100
3f2d1365 101 <listitem><para>Launch an instance of the service program for each connection and pass the connection
eef0a274 102 socket.</para></listitem>
2ca0435b 103 </varlistentry>
5e65c93a 104
530a071a
SS
105 <varlistentry>
106 <term><option>-d</option></term>
107 <term><option>--datagram</option></term>
108
d31e430f
LP
109 <listitem><para>Listen on a datagram socket (<constant>SOCK_DGRAM</constant>), instead of a stream socket
110 (<constant>SOCK_STREAM</constant>). May not be combined with <option>--seqpacket</option>.</para></listitem>
111 </varlistentry>
112
113 <varlistentry>
114 <term><option>--seqpacket</option></term>
115
116 <listitem><para>Listen on a sequential packet socket (<constant>SOCK_SEQPACKET</constant>), instead of a stream
117 socket (<constant>SOCK_STREAM</constant>). May not be combined with
118 <option>--datagram</option>.</para></listitem>
530a071a
SS
119 </varlistentry>
120
eef0a274
LP
121 <varlistentry>
122 <term><option>--inetd</option></term>
123
124 <listitem><para>Use the inetd protocol for passing file descriptors, i.e. as standard input and standard
125 output, instead of the new-style protocol for passing file descriptors using <varname>$LISTEN_FDS</varname>
126 (see above).</para></listitem>
127 </varlistentry>
128
5e65c93a
ZJS
129 <varlistentry>
130 <term><option>-E <replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
892213bf 131 <term><option>--setenv=<replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
5e65c93a
ZJS
132
133 <listitem><para>Add this variable to the environment of the
134 launched process. If <replaceable>VAR</replaceable> is
79640424
JE
135 followed by <literal>=</literal>, assume that it is a
136 variable–value pair. Otherwise, obtain the value from the
7f6e8043 137 environment of <command>systemd-socket-activate</command> itself.
5e65c93a
ZJS
138 </para></listitem>
139 </varlistentry>
dfdebb1b 140
8dd4c05b 141 <varlistentry>
1eecafb8 142 <term><option>--fdname=</option><replaceable>NAME</replaceable><optional>:<replaceable>NAME</replaceable>…</optional></term>
cf98937c
ZJS
143
144 <listitem><para>Specify names for the file descriptors passed. This is equivalent to setting
145 <varname>FileDescriptorName=</varname> in socket unit files, and enables use of
146 <citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
147 Multiple entries may be specifies using separate options or by separating names with colons
b17649ee 148 (<literal>:</literal>) in one option. In case more names are given than descriptors, superfluous ones will be
cf98937c
ZJS
149 ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed.
150 </para></listitem>
8dd4c05b
LP
151 </varlistentry>
152
dfdebb1b
ZJS
153 <xi:include href="standard-options.xml" xpointer="help" />
154 <xi:include href="standard-options.xml" xpointer="version" />
2ca0435b
ZJS
155 </variablelist>
156 </refsect1>
157
158 <refsect1>
159 <title>Environment variables</title>
160 <variablelist class='environment-variables'>
161 <varlistentry>
162 <term><varname>$LISTEN_FDS</varname></term>
163 <term><varname>$LISTEN_PID</varname></term>
8dd4c05b 164 <term><varname>$LISTEN_FDNAMES</varname></term>
2ca0435b 165
1446560f
ZJS
166 <listitem><para>See
167 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para></listitem>
2ca0435b
ZJS
168 </varlistentry>
169
170 <varlistentry>
171 <term><varname>$SYSTEMD_LOG_TARGET</varname></term>
172 <term><varname>$SYSTEMD_LOG_LEVEL</varname></term>
173 <term><varname>$SYSTEMD_LOG_COLOR</varname></term>
174 <term><varname>$SYSTEMD_LOG_LOCATION</varname></term>
175
1446560f
ZJS
176 <listitem><para>Same as in
177 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para></listitem>
2ca0435b
ZJS
178 </varlistentry>
179 </variablelist>
180 </refsect1>
181
182 <refsect1>
1db8c66f 183 <title>Examples</title>
2ca0435b 184
1db8c66f
RC
185 <example>
186 <title>Run an echo server on port 2000</title>
2ca0435b 187
7f6e8043 188 <programlisting>$ systemd-socket-activate -l 2000 --inetd -a cat</programlisting>
1db8c66f 189 </example>
2ca0435b 190
1db8c66f 191 <example>
b938cb90 192 <title>Run a socket-activated instance of <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
2ca0435b 193
7f6e8043 194 <programlisting>$ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd</programlisting>
1db8c66f 195 </example>
2ca0435b
ZJS
196 </refsect1>
197
198 <refsect1>
199 <title>See Also</title>
200 <para>
201 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
202 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
203 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
cac26f0b 204 <citerefentry><refentrytitle>systemd-run</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
8dd4c05b
LP
205 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
206 <citerefentry><refentrytitle>sd_listen_fds_with_names</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
3ba3a79d 207 <citerefentry project='man-pages'><refentrytitle>cat</refentrytitle><manvolnum>1</manvolnum></citerefentry>
2ca0435b
ZJS
208 </para>
209 </refsect1>
210</refentry>