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