2018-07-03 00:15:39 +03:00
<?xml version='1.0'?>
2019-03-14 16:40:58 +03:00
< !DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
2023-12-25 17:48:33 +03:00
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
2020-11-09 07:23:58 +03:00
<!-- SPDX - License - Identifier: LGPL - 2.1 - or - later -->
2013-02-23 20:52:04 +04:00
2016-02-12 06:11:33 +03:00
<refentry id= "systemd-socket-activate"
2014-02-13 23:33:51 +04:00
xmlns:xi="http://www.w3.org/2001/XInclude">
2013-02-23 20:52:04 +04:00
<refentryinfo >
2016-02-12 06:11:33 +03:00
<title > systemd-socket-activate</title>
2013-02-23 20:52:04 +04:00
<productname > systemd</productname>
</refentryinfo>
<refmeta >
2016-02-12 06:11:33 +03:00
<refentrytitle > systemd-socket-activate</refentrytitle>
<manvolnum > 1</manvolnum>
2013-02-23 20:52:04 +04:00
</refmeta>
<refnamediv >
2016-02-12 06:11:33 +03:00
<refname > systemd-socket-activate</refname>
2013-02-23 20:52:04 +04:00
<refpurpose > Test socket activation of daemons</refpurpose>
</refnamediv>
<refsynopsisdiv >
<cmdsynopsis >
2016-02-12 06:11:33 +03:00
<command > systemd-socket-activate</command>
2013-02-23 20:52:04 +04:00
<arg choice= "opt" rep= "repeat" > OPTIONS</arg>
<arg choice= "plain" > <replaceable > daemon</replaceable> </arg>
<arg choice= "opt" rep= "repeat" > OPTIONS</arg>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 >
<title > Description</title>
2017-12-16 13:48:12 +03:00
<para > <command > systemd-socket-activate</command> may be used to launch a socket-activated service program from the
command line for testing purposes. It may also be used to launch individual instances of the service program per
connection.
2013-02-23 20:52:04 +04:00
</para>
2015-05-11 14:49:29 +03:00
<para > The daemon to launch and its options should be specified
2016-02-12 06:11:33 +03:00
after options intended for <command > systemd-socket-activate</command> .
2013-02-23 20:52:04 +04:00
</para>
2016-02-08 23:13:09 +03:00
<para > If the <option > --inetd</option> option is given, the socket file descriptor will be used as the standard
input and output of the launched process. Otherwise, standard input and output will be inherited, and sockets will
be passed through file descriptors 3 and higher. Sockets passed through <varname > $LISTEN_FDS</varname> to
2016-02-12 06:11:33 +03:00
<command > systemd-socket-activate</command> will be passed through to the daemon, in the original positions. Other sockets
2016-02-08 23:13:09 +03:00
specified with <option > --listen=</option> will use consecutive descriptors. By default,
2016-02-12 06:11:33 +03:00
<command > systemd-socket-activate</command> listens on a stream socket, use <option > --datagram</option> and
2016-02-08 23:13:09 +03:00
<option > --seqpacket</option> to listen on datagram or sequential packet sockets instead (see below).
2013-02-23 20:52:04 +04:00
</para>
</refsect1>
<refsect1 >
<title > Options</title>
<variablelist >
<varlistentry >
2013-03-16 02:57:44 +04:00
<term > <option > -l <replaceable > address</replaceable> </option> </term>
2013-02-23 20:52:04 +04:00
<term > <option > --listen=<replaceable > address</replaceable> </option> </term>
<listitem > <para > Listen on this <replaceable > address</replaceable> .
Takes a string like <literal > 2000</literal> or
<literal > 127.0.0.1:2001</literal> .</para>
2023-08-22 19:52:36 +03:00
<xi:include href= "version-info.xml" xpointer= "v230" />
2013-02-23 20:52:04 +04:00
</listitem>
</varlistentry>
<varlistentry >
<term > <option > -a</option> </term>
<term > <option > --accept</option> </term>
2017-12-16 13:48:12 +03:00
<listitem > <para > Launch an instance of the service program for each connection and pass the connection
2023-08-22 19:52:36 +03:00
socket.</para>
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2013-02-23 20:52:04 +04:00
</varlistentry>
2013-03-16 02:57:44 +04:00
2016-01-22 07:12:54 +03:00
<varlistentry >
<term > <option > -d</option> </term>
<term > <option > --datagram</option> </term>
2016-02-08 21:47:06 +03:00
<listitem > <para > Listen on a datagram socket (<constant > SOCK_DGRAM</constant> ), instead of a stream socket
2023-08-22 19:52:36 +03:00
(<constant > SOCK_STREAM</constant> ). May not be combined with <option > --seqpacket</option> .</para>
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2016-02-08 21:47:06 +03:00
</varlistentry>
<varlistentry >
<term > <option > --seqpacket</option> </term>
<listitem > <para > Listen on a sequential packet socket (<constant > SOCK_SEQPACKET</constant> ), instead of a stream
socket (<constant > SOCK_STREAM</constant> ). May not be combined with
2023-08-22 19:52:36 +03:00
<option > --datagram</option> .</para>
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2016-01-22 07:12:54 +03:00
</varlistentry>
2016-02-08 23:13:09 +03:00
<varlistentry >
<term > <option > --inetd</option> </term>
<listitem > <para > Use the inetd protocol for passing file descriptors, i.e. as standard input and standard
output, instead of the new-style protocol for passing file descriptors using <varname > $LISTEN_FDS</varname>
2023-08-22 19:52:36 +03:00
(see above).</para>
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2016-02-08 23:13:09 +03:00
</varlistentry>
2013-03-16 02:57:44 +04:00
<varlistentry >
<term > <option > -E <replaceable > VAR</replaceable> <optional > =<replaceable > VALUE</replaceable> </optional> </option> </term>
2013-12-29 23:56:09 +04:00
<term > <option > --setenv=<replaceable > VAR</replaceable> <optional > =<replaceable > VALUE</replaceable> </optional> </option> </term>
2013-03-16 02:57:44 +04:00
<listitem > <para > Add this variable to the environment of the
launched process. If <replaceable > VAR</replaceable> is
2013-09-12 23:12:49 +04:00
followed by <literal > =</literal> , assume that it is a
variable– value pair. Otherwise, obtain the value from the
2016-02-12 06:11:33 +03:00
environment of <command > systemd-socket-activate</command> itself.
2023-08-22 19:52:36 +03:00
</para>
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2013-03-16 02:57:44 +04:00
</varlistentry>
2014-02-13 23:33:51 +04:00
2015-10-04 18:36:19 +03:00
<varlistentry >
2016-12-12 01:01:07 +03:00
<term > <option > --fdname=</option> <replaceable > NAME</replaceable> <optional > :<replaceable > NAME</replaceable> …</optional> </term>
2016-02-12 07:33:09 +03:00
<listitem > <para > Specify names for the file descriptors passed. This is equivalent to setting
<varname > FileDescriptorName=</varname> in socket unit files, and enables use of
<citerefentry > <refentrytitle > sd_listen_fds_with_names</refentrytitle> <manvolnum > 3</manvolnum> </citerefentry> .
Multiple entries may be specifies using separate options or by separating names with colons
2016-10-31 15:08:08 +03:00
(<literal > :</literal> ) in one option. In case more names are given than descriptors, superfluous ones will be
2016-02-12 07:33:09 +03:00
ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed.
2023-08-22 19:52:36 +03:00
</para>
2023-09-18 18:03:38 +03:00
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2015-10-04 18:36:19 +03:00
</varlistentry>
2014-02-13 23:33:51 +04:00
<xi:include href= "standard-options.xml" xpointer= "help" />
<xi:include href= "standard-options.xml" xpointer= "version" />
2013-02-23 20:52:04 +04:00
</variablelist>
</refsect1>
<refsect1 >
<title > Environment variables</title>
<variablelist class= 'environment-variables' >
<varlistentry >
<term > <varname > $LISTEN_FDS</varname> </term>
<term > <varname > $LISTEN_PID</varname> </term>
2015-10-04 18:36:19 +03:00
<term > <varname > $LISTEN_FDNAMES</varname> </term>
2013-02-23 20:52:04 +04:00
2013-02-28 07:38:26 +04:00
<listitem > <para > See
2023-08-22 19:52:36 +03:00
<citerefentry > <refentrytitle > sd_listen_fds</refentrytitle> <manvolnum > 3</manvolnum> </citerefentry> .</para>
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2013-02-23 20:52:04 +04:00
</varlistentry>
<varlistentry >
<term > <varname > $SYSTEMD_LOG_TARGET</varname> </term>
<term > <varname > $SYSTEMD_LOG_LEVEL</varname> </term>
2019-07-15 16:56:24 +03:00
<term > <varname > $SYSTEMD_LOG_TIME</varname> </term>
2013-02-23 20:52:04 +04:00
<term > <varname > $SYSTEMD_LOG_COLOR</varname> </term>
<term > <varname > $SYSTEMD_LOG_LOCATION</varname> </term>
2013-02-28 07:38:26 +04:00
<listitem > <para > Same as in
2023-09-18 18:03:38 +03:00
<citerefentry > <refentrytitle > systemd</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> .</para>
<xi:include href= "version-info.xml" xpointer= "v230" /> </listitem>
2013-02-23 20:52:04 +04:00
</varlistentry>
</variablelist>
</refsect1>
<refsect1 >
2014-10-12 02:37:23 +04:00
<title > Examples</title>
2013-02-23 20:52:04 +04:00
2014-10-12 02:37:23 +04:00
<example >
<title > Run an echo server on port 2000</title>
2013-02-23 20:52:04 +04:00
2016-02-12 06:11:33 +03:00
<programlisting > $ systemd-socket-activate -l 2000 --inetd -a cat</programlisting>
2014-10-12 02:37:23 +04:00
</example>
2013-02-23 20:52:04 +04:00
2014-10-12 02:37:23 +04:00
<example >
2014-08-03 09:11:12 +04:00
<title > Run a socket-activated instance of <citerefentry > <refentrytitle > systemd-journal-gatewayd</refentrytitle> <manvolnum > 8</manvolnum> </citerefentry> </title>
2013-02-23 20:52:04 +04:00
2016-02-12 06:11:33 +03:00
<programlisting > $ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd</programlisting>
2014-10-12 02:37:23 +04:00
</example>
2013-02-23 20:52:04 +04:00
</refsect1>
<refsect1 >
<title > See Also</title>
2023-12-22 21:09:32 +03:00
<para > <simplelist type= "inline" >
<member > <citerefentry > <refentrytitle > systemd</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > systemd.socket</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > systemd.service</refentrytitle> <manvolnum > 5</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > systemd-run</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > sd_listen_fds</refentrytitle> <manvolnum > 3</manvolnum> </citerefentry> </member>
<member > <citerefentry > <refentrytitle > sd_listen_fds_with_names</refentrytitle> <manvolnum > 3</manvolnum> </citerefentry> </member>
<member > <citerefentry project= 'man-pages' > <refentrytitle > cat</refentrytitle> <manvolnum > 1</manvolnum> </citerefentry> </member>
</simplelist> </para>
2013-02-23 20:52:04 +04:00
</refsect1>
</refentry>