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