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