|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From 30d88d54f613f9f7831172876ebfd9e285fb043b Mon Sep 17 00:00:00 2001
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Date: Tue, 7 Oct 2014 09:19:24 -0400
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
Subject: [PATCH] man: move commandline parsing to a separate section
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
It is very long already, and obscures the description of
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
ExecStart, and it is about to get longer.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
---
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
man/systemd.service.xml | 298 ++++++++++++++++++++++++------------------------
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
1 file changed, 148 insertions(+), 150 deletions(-)
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
diff --git a/man/systemd.service.xml b/man/systemd.service.xml
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
index b9a2f8d82f..dbc82edbd4 100644
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
--- a/man/systemd.service.xml
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+++ b/man/systemd.service.xml
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -352,72 +352,59 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<term><varname>ExecStart=</varname></term>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<listitem><para>Commands with their
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
arguments that are executed when this
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- service is started. For each of the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- specified commands, the first argument
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- must be an absolute and literal path
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- to an executable.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ service is started. The value is split
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ into zero or more command lines is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ according to the rules described below
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ (see section "Command Lines" below).
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<para>When <varname>Type</varname> is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
not <option>oneshot</option>, only one
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
command may and must be given. When
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<varname>Type=oneshot</varname> is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- used, none or more than one command
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- may be specified. Multiple command
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- lines may be concatenated in a single
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- directive by separating them with
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- semicolons (these semicolons must be
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- passed as separate
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- words). Alternatively, this directive
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- may be specified more than once with
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- the same effect. Lone semicolons may
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- be escaped as
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>\;</literal>. If the empty
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- string is assigned to this option, the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- list of commands to start is reset,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- prior assignments of this option will
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- have no effect. If no
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ used, zero or more commands may be
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ specified. This can be specified by
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ providing multiple command lines in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ the same directive , or alternatively,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ this directive may be specified more
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ than once with the same effect. If the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ empty string is assigned to this
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ option, the list of commands to start
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ is reset, prior assignments of this
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ option will have no effect. If no
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<varname>ExecStart=</varname> is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
specified, then the service must have
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<varname>RemainAfterExit=yes</varname>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
set.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Each command line is split on
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- whitespace, with the first item being
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- the command to execute, and the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- subsequent items being the arguments.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- Double quotes ("...") and single
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- quotes ('...') may be used, in which
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- case everything until the next
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- matching quote becomes part of the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- same argument. Quotes themselves are
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- removed after parsing. In addition, a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- trailing backslash
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- (<literal>\</literal>) may be used to
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- merge lines. This syntax is intended
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- to be very similar to shell syntax,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- but only the meta-characters and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- expansions described in the following
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- paragraphs are understood.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- Specifically, redirection using
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal><</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal><<</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>></literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>>></literal>, pipes
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- using <literal>|</literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- running programs in the background
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- using <literal>&</literal>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- and <emphasis>other elements of shell
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- syntax are not supported</emphasis>.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- </para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>For each of the specified
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ commands, the first argument must be
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ an absolute and literal path to an
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ executable. Optionally, if the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ absolute file name is prefixed with
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>@</literal>, the second token
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ will be passed as
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>argv[0]</literal> to the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ executed process, followed by the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ further arguments specified. If the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ absolute filename is prefixed with
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>-</literal>, an exit code of
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ the command normally considered a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ failure (i.e. non-zero exit status or
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ abnormal exit due to signal) is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ ignored and considered success. If
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ both <literal>-</literal> and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>@</literal> are used, they
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ can appear in either order.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<para>If more than one command is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
specified, the commands are invoked
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
sequentially in the order they appear
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
in the unit file. If one of the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
commands fails (and is not prefixed
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- with <literal>-</literal>), other lines
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- are not executed, and the unit is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- considered failed.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ with <literal>-</literal>), other
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ lines are not executed, and the unit
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ is considered failed.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<para>Unless
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<varname>Type=forking</varname> is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -425,106 +412,6 @@
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
command line will be considered the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
main process of the daemon.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>The command line accepts
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>%</literal> specifiers as
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- described in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- Note that the first argument of the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- command line (i.e. the program to
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- execute) may not include
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- specifiers.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Basic environment variable
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- substitution is supported. Use
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>${FOO}</literal> as part of a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- word, or as a word of its own, on the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- command line, in which case it will be
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- replaced by the value of the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- environment variable including all
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- whitespace it contains, resulting in a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- single argument. Use
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>$FOO</literal> as a separate
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- word on the command line, in which
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- case it will be replaced by the value
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- of the environment variable split at
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- whitespace, resulting in zero or more
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- arguments. To pass a literal dollar
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- sign, use <literal>$$</literal>.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- Variables whose value is not known at
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- expansion time are treated as empty
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- strings. Note that the first argument
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- (i.e. the program to execute) may not
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- be a variable.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Variables to be used in this
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- fashion may be defined through
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <varname>Environment=</varname> and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <varname>EnvironmentFile=</varname>.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- In addition, variables listed in the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- section "Environment variables in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- spawned processes" in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- which are considered "static
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- configuration", may be used (this includes
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- e.g. <varname>$USER</varname>, but not
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <varname>$TERM</varname>).</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Optionally, if the absolute file
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- name is prefixed with
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>@</literal>, the second token
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- will be passed as
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>argv[0]</literal> to the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- executed process, followed by the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- further arguments specified. If the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- absolute filename is prefixed with
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>-</literal>, an exit code of
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- the command normally considered a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- failure (i.e. non-zero exit status or
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- abnormal exit due to signal) is ignored
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- and considered success. If both
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>-</literal> and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>@</literal> are used, they
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- can appear in either order.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Note that this setting does not
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- directly support shell command
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- lines. If shell command lines are to
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- be used, they need to be passed
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- explicitly to a shell implementation
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- of some kind. Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <programlisting>ExecStart=/bin/sh -c 'dmesg | tac'</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <programlisting>ExecStart=/bin/echo one ; /bin/echo "two two"</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>This will execute
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <command>/bin/echo</command> two
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- times, each time with one argument:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>one</literal> and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>two two</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- respectively. Because two commands are
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- specified,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <varname>Type=oneshot</varname> must
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- be used.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <programlisting>ExecStart=/bin/echo / >/dev/null & \; \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-/bin/ls</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>This will execute
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <command>/bin/echo</command> with five
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- arguments: <literal>/</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>>/dev/null</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>&</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>;</literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>/bin/ls</literal>.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <programlisting>Environment="ONE=one" 'TWO=two two'
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
-ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <para>This will execute
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <command>/bin/echo</command> with four
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- arguments: <literal>one</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>two</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>two</literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
- <literal>two two</literal>.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
</listitem>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
</varlistentry>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
@@ -1274,6 +1161,117 @@ ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
</refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <title>Command lines</title>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>This section describes command line parsing and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ variable and specifier substitions for
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>ExecStart=</varname>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>ExecStartPre=</varname>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>ExecStartPost=</varname>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>ExecReload=</varname>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>ExecStop=</varname>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>ExecStopPost=</varname> options.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Multiple command lines may be concatenated in a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ single directive by separating them with semicolons
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ (these semicolons must be passed as separate words).
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ Lone semicolons may be escaped as
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>\;</literal>.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Each command line is split on whitespace, with
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ the first item being the command to execute, and the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ subsequent items being the arguments. Double quotes
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ ("...") and single quotes ('...') may be used, in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ which case everything until the next matching quote
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ becomes part of the same argument. Quotes themselves
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ are removed after parsing. In addition, a trailing
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ backslash (<literal>\</literal>) may be used to merge
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ lines. </para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>This syntax is intended to be very similar to
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ shell syntax, but only the meta-characters and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ expansions described in the following paragraphs are
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ understood. Specifically, redirection using
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal><</literal>, <literal><<</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>></literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>>></literal>, pipes using
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>|</literal>, running programs in the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ background using <literal>&</literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <emphasis>other elements of shell syntax are not
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ supported</emphasis>.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>The command line accepts <literal>%</literal>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ specifiers as described in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ Note that the first argument of the command line
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ (i.e. the program to execute) may not include
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ specifiers.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Basic environment variable substitution is
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ supported. Use <literal>${FOO}</literal> as part of a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ word, or as a word of its own, on the command line, in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ which case it will be replaced by the value of the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ environment variable including all whitespace it
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ contains, resulting in a single argument. Use
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>$FOO</literal> as a separate word on the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ command line, in which case it will be replaced by the
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ value of the environment variable split at whitespace,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ resulting in zero or more arguments. To pass a literal
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ dollar sign, use <literal>$$</literal>. Variables
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ whose value is not known at expansion time are treated
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ as empty strings. Note that the first argument
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ (i.e. the program to execute) may not be a
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ variable.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Variables to be used in this fashion may be
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ defined through <varname>Environment=</varname> and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>EnvironmentFile=</varname>. In addition,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ variables listed in the section "Environment variables
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ in spawned processes" in
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ which are considered "static configuration", may be
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ used (this includes e.g. <varname>$USER</varname>, but
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ not <varname>$TERM</varname>).</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Note that shell command lines are not directly
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ supported. If shell command lines are to be used, they
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ need to be passed explicitly to a shell implementation
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ of some kind. Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <programlisting>ExecStart=/bin/sh -c 'dmesg | tac'</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <programlisting>ExecStart=/bin/echo one ; /bin/echo "two two"</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>This will execute <command>/bin/echo</command>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ two times, each time with one argument:
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>one</literal> and <literal>two two</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ respectively. Because two commands are specified,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <varname>Type=oneshot</varname> must be used.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <programlisting>ExecStart=/bin/echo / >/dev/null & \; \
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+/bin/ls</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>This will execute <command>/bin/echo</command>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ with five arguments: <literal>/</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>>/dev/null</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>&</literal>, <literal>;</literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>/bin/ls</literal>.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>Example:</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <programlisting>Environment="ONE=one" 'TWO=two two'
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ExecStart=/bin/echo $ONE $TWO ${TWO}</programlisting>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <para>This will execute <command>/bin/echo</command>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ with four arguments: <literal>one</literal>,
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>two</literal>, <literal>two</literal>, and
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <literal>two two</literal>.</para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ </refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
+ <refsect1>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<title>See Also</title>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<para>
|
|
Zbigniew Jędrzejewski-Szmek |
62fe94 |
<citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
|