]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
man/systemd.service: add example for char prefixes
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 2 Apr 2023 18:16:01 +0000 (20:16 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 4 Apr 2023 13:18:00 +0000 (15:18 +0200)
The prefixes can be specified for any part of the command. The docs imply this,
but it's not entirely obvious. Let's add an example.

man/systemd.service.xml

index 036ac66b2de37aa7a98096bb5660051e5d1c638d..f64a8e538ff473370f248594f83395ca584b989f 100644 (file)
         <tbody>
           <row>
             <entry><literal>@</literal></entry>
-            <entry>If the executable path is prefixed with <literal>@</literal>, the second specified token will be passed as <literal>argv[0]</literal> to the executed process (instead of the actual filename), followed by the further arguments specified.</entry>
+            <entry>If the executable path is prefixed with <literal>@</literal>, the second specified token will be passed as <constant>argv[0]</constant> to the executed process (instead of the actual filename), followed by the further arguments specified.</entry>
           </row>
 
           <row>
@@ -1364,6 +1364,17 @@ ExecStart=/bin/echo $ONE $TWO $THREE</programlisting>
 
     <para>Example:</para>
 
+    <programlisting>Type=oneshot
+ExecStart=:echo $USER ; -false ; +:@true $TEST</programlisting>
+
+    <para>This will execute <command>/usr/bin/echo</command> with the literal argument
+    <literal>$USER</literal> (<literal>:</literal> suppresses variable expansion), and then
+    <command>/usr/bin/false</command> (the return value will be ignored because <literal>-</literal>
+    suppresses checking of the return value), and <command>/usr/bin/true</command> (with elevated privileges,
+    with <literal>$TEST</literal> as <constant>argv[0]</constant>).</para>
+
+    <para>Example:</para>
+
     <programlisting>ExecStart=echo / &gt;/dev/null &amp; \; \
 ls</programlisting>