systemd/man/systemd-socket-activate.xml
2024-04-15 10:40:11 +02:00

201 lines
8.6 KiB
XML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?xml version='1.0'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd">
<!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
<refentry id="systemd-socket-activate"
xmlns:xi="http://www.w3.org/2001/XInclude">
<refentryinfo>
<title>systemd-socket-activate</title>
<productname>systemd</productname>
</refentryinfo>
<refmeta>
<refentrytitle>systemd-socket-activate</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>systemd-socket-activate</refname>
<refpurpose>Test socket activation of daemons</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>systemd-socket-activate</command>
<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>
<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.
</para>
<para>The daemon to launch and its options should be specified
after options intended for <command>systemd-socket-activate</command>.
</para>
<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
<command>systemd-socket-activate</command> will be passed through to the daemon, in the original positions. Other sockets
specified with <option>--listen=</option> will use consecutive descriptors. By default,
<command>systemd-socket-activate</command> listens on a stream socket, use <option>--datagram</option> and
<option>--seqpacket</option> to listen on datagram or sequential packet sockets instead (see below).
</para>
</refsect1>
<refsect1>
<title>Options</title>
<variablelist>
<varlistentry>
<term><option>-l <replaceable>address</replaceable></option></term>
<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>
<xi:include href="version-info.xml" xpointer="v230"/>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-a</option></term>
<term><option>--accept</option></term>
<listitem><para>Launch an instance of the service program for each connection and pass the connection
socket.</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</varlistentry>
<varlistentry>
<term><option>-d</option></term>
<term><option>--datagram</option></term>
<listitem><para>Listen on a datagram socket (<constant>SOCK_DGRAM</constant>), instead of a stream socket
(<constant>SOCK_STREAM</constant>). May not be combined with <option>--seqpacket</option>.</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</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
<option>--datagram</option>.</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</varlistentry>
<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>
(see above).</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</varlistentry>
<varlistentry>
<term><option>-E <replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
<term><option>--setenv=<replaceable>VAR</replaceable><optional>=<replaceable>VALUE</replaceable></optional></option></term>
<listitem><para>Add this variable to the environment of the
launched process. If <replaceable>VAR</replaceable> is
followed by <literal>=</literal>, assume that it is a
variablevalue pair. Otherwise, obtain the value from the
environment of <command>systemd-socket-activate</command> itself.
</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</varlistentry>
<varlistentry>
<term><option>--fdname=<replaceable>NAME</replaceable><optional>:<replaceable>NAME</replaceable></optional></option></term>
<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
(<literal>:</literal>) in one option. In case more names are given than descriptors, superfluous ones will be
ignored. In case less names are given than descriptors, the remaining file descriptors will be unnamed.
</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</varlistentry>
<xi:include href="standard-options.xml" xpointer="help" />
<xi:include href="standard-options.xml" xpointer="version" />
</variablelist>
</refsect1>
<refsect1>
<title>Environment variables</title>
<variablelist class='environment-variables'>
<varlistentry>
<term><varname>$LISTEN_FDS</varname></term>
<term><varname>$LISTEN_PID</varname></term>
<term><varname>$LISTEN_FDNAMES</varname></term>
<listitem><para>See
<citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</varlistentry>
<varlistentry>
<term><varname>$SYSTEMD_LOG_TARGET</varname></term>
<term><varname>$SYSTEMD_LOG_LEVEL</varname></term>
<term><varname>$SYSTEMD_LOG_TIME</varname></term>
<term><varname>$SYSTEMD_LOG_COLOR</varname></term>
<term><varname>$SYSTEMD_LOG_LOCATION</varname></term>
<listitem><para>Same as in
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>.</para>
<xi:include href="version-info.xml" xpointer="v230"/></listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
<title>Examples</title>
<example>
<title>Run an echo server on port 2000</title>
<programlisting>$ systemd-socket-activate -l 2000 --inetd -a cat</programlisting>
</example>
<example>
<title>Run a socket-activated instance of <citerefentry><refentrytitle>systemd-journal-gatewayd</refentrytitle><manvolnum>8</manvolnum></citerefentry></title>
<programlisting>$ systemd-socket-activate -l 19531 /usr/lib/systemd/systemd-journal-gatewayd</programlisting>
</example>
</refsect1>
<refsect1>
<title>See Also</title>
<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>
</refsect1>
</refentry>