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">
6 This file is part of systemd.
8 Copyright 2013 Zbigniew Jędrzejewski-Szmek
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.
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.
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/>.
24 <refentry id=
"systemd-activate"
25 xmlns:
xi=
"http://www.w3.org/2001/XInclude">
28 <title>systemd-activate
</title>
29 <productname>systemd
</productname>
33 <contrib>Developer
</contrib>
34 <firstname>Zbigniew
</firstname>
35 <surname>Jędrzejewski-Szmek
</surname>
36 <email>zbyszek@in.waw.pl
</email>
42 <refentrytitle>systemd-activate
</refentrytitle>
43 <manvolnum>8</manvolnum>
47 <refname>systemd-activate
</refname>
48 <refpurpose>Test socket activation of daemons
</refpurpose>
53 <command>/usr/lib/systemd/systemd-activate
</command>
54 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
55 <arg choice=
"plain"><replaceable>daemon
</replaceable></arg>
56 <arg choice=
"opt" rep=
"repeat">OPTIONS
</arg>
61 <title>Description
</title>
63 <para><command>systemd-activate
</command> may be used to launch a socket-activated service binary from the command
64 line for testing purposes. It may also be used to launch individual instances of the service binary per connection.
67 <para>The daemon to launch and its options should be specified
68 after options intended for
<command>systemd-activate
</command>.
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
74 <command>systemd-activate
</command> will be passed through to the daemon, in the original positions. Other sockets
75 specified with
<option>--listen=
</option> will use consecutive descriptors. By default,
76 <command>systemd-activate
</command> listens on a stream socket, use
<option>--datagram
</option> and
77 <option>--seqpacket
</option> to listen on datagram or sequential packet sockets instead (see below).
82 <title>Options
</title>
85 <term><option>-l
<replaceable>address
</replaceable></option></term>
86 <term><option>--listen=
<replaceable>address
</replaceable></option></term>
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>
95 <term><option>-a
</option></term>
96 <term><option>--accept
</option></term>
98 <listitem><para>Launch an instance of the service binary for each connection and pass the connection
99 socket.
</para></listitem>
103 <term><option>-d
</option></term>
104 <term><option>--datagram
</option></term>
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>
111 <term><option>--seqpacket
</option></term>
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>
119 <term><option>--inetd
</option></term>
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>
127 <term><option>-E
<replaceable>VAR
</replaceable><optional>=
<replaceable>VALUE
</replaceable></optional></option></term>
128 <term><option>--setenv=
<replaceable>VAR
</replaceable><optional>=
<replaceable>VALUE
</replaceable></optional></option></term>
130 <listitem><para>Add this variable to the environment of the
131 launched process. If
<replaceable>VAR
</replaceable> is
132 followed by
<literal>=
</literal>, assume that it is a
133 variable–value pair. Otherwise, obtain the value from the
134 environment of
<command>systemd-activate
</command> itself.
139 <term><option>--fdname=
</option><replaceable>NAME
</replaceable></term>
141 <listitem><para>Specify a name for the activation file
142 descriptors. This is equivalent to setting
143 <varname>FileDescriptorName=
</varname> in socket unit files, and
145 <citerefentry><refentrytitle>sd_listen_fds_with_names
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para></listitem>
148 <xi:include href=
"standard-options.xml" xpointer=
"help" />
149 <xi:include href=
"standard-options.xml" xpointer=
"version" />
154 <title>Environment variables
</title>
155 <variablelist class='environment-variables'
>
157 <term><varname>$LISTEN_FDS
</varname></term>
158 <term><varname>$LISTEN_PID
</varname></term>
159 <term><varname>$LISTEN_FDNAMES
</varname></term>
162 <citerefentry><refentrytitle>sd_listen_fds
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
</para></listitem>
166 <term><varname>$SYSTEMD_LOG_TARGET
</varname></term>
167 <term><varname>$SYSTEMD_LOG_LEVEL
</varname></term>
168 <term><varname>$SYSTEMD_LOG_COLOR
</varname></term>
169 <term><varname>$SYSTEMD_LOG_LOCATION
</varname></term>
171 <listitem><para>Same as in
172 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
</para></listitem>
178 <title>Examples
</title>
181 <title>Run an echo server on port
2000</title>
183 <programlisting>$ /usr/lib/systemd/systemd-activate -l
2000 --inetd -a cat
</programlisting>
187 <title>Run a socket-activated instance of
<citerefentry><refentrytitle>systemd-journal-gatewayd
</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
189 <programlisting>$ /usr/lib/systemd/systemd-activate -l
19531 /usr/lib/systemd/systemd-journal-gatewayd
</programlisting>
194 <title>See Also
</title>
196 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
197 <citerefentry><refentrytitle>systemd.socket
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
198 <citerefentry><refentrytitle>systemd.service
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
199 <citerefentry><refentrytitle>sd_listen_fds
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
200 <citerefentry><refentrytitle>sd_listen_fds_with_names
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
201 <citerefentry project='man-pages'
><refentrytitle>cat
</refentrytitle><manvolnum>1</manvolnum></citerefentry>