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