~ubuntu-branches/ubuntu/trusty/systemd/trusty

« back to all changes in this revision

Viewing changes to man/systemd.service.xml

Tags: upstream-202
ImportĀ upstreamĀ versionĀ 202

Show diffs side-by-side

added added

removed removed

Lines of Context:
302
302
                                argument must be an absolute path
303
303
                                name.</para>
304
304
 
305
 
                                <para>When
 
305
                                <para>When <varname>Type</varname> is
 
306
                                not <option>oneshot</option>, only one
 
307
                                command may be given. When
306
308
                                <varname>Type=oneshot</varname> is
307
309
                                used, more than one command may be
308
310
                                specified. Multiple command lines may
316
318
                                for compatibility with parsers
317
319
                                suitable for XDG
318
320
                                <filename>.desktop</filename> files.
319
 
                                The commands are invoked one by one
320
 
                                sequentially in the order they appear
321
 
                                in the unit file.  When
322
 
                                <varname>Type</varname> is not
323
 
                                <option>oneshot</option>, only one
324
 
                                command may be given. Lone semicolons
325
 
                                may be escaped as
 
321
                                Lone semicolons may be escaped as
326
322
                                '<literal>\;</literal>'. If the empty
327
323
                                string is assigned to this option the
328
324
                                list of commands to start is reset,
329
325
                                prior assignments of this option will
330
326
                                have no effect.</para>
331
327
 
 
328
                                <para>If more than one command is
 
329
                                specified, the commands are invoked
 
330
                                one by one sequentially in the order
 
331
                                they appear in the unit file. If one
 
332
                                of the commands fails (and is not
 
333
                                prefixed with '<literal>-</literal>'),
 
334
                                other lines are not executed and the
 
335
                                unit is considered failed.</para>
 
336
 
332
337
                                <para>Unless
333
338
                                <varname>Type=forking</varname> is
334
339
                                set, the process started via this
343
348
                                line (i.e. the program to execute) may
344
349
                                not include specifiers.</para>
345
350
 
346
 
                                <para>On top of that basic environment
347
 
                                variable substitution is
348
 
                                supported. Use
 
351
                                <para>Basic environment variable
 
352
                                substitution is supported. Use
349
353
                                <literal>${FOO}</literal> as part of a
350
354
                                word, or as a word of its own on the
351
355
                                command line, in which case it will be
357
361
                                word on the command line, in which
358
362
                                case it will be replaced by the value
359
363
                                of the environment variable split up
360
 
                                at whitespace, resulting in no or more
361
 
                                arguments. Note that the first
 
364
                                at whitespace, resulting in zero or
 
365
                                more arguments. Note that the first
362
366
                                argument (i.e. the program to execute)
363
367
                                may not be a variable, since it must
364
368
                                be a literal and absolute path
386
390
                                lines. If shell command lines are to
387
391
                                be used they need to be passed
388
392
                                explicitly to a shell implementation
389
 
                                of some kind. Example:
390
 
                                <literal>ExecStart=/bin/sh -c 'dmesg | tac'</literal></para>
 
393
                                of some kind. Example:</para>
 
394
                                <programlisting>ExecStart=/bin/sh -c 'dmesg | tac'
 
395
                                </programlisting>
391
396
 
392
397
                                <para>For services run by a user
393
398
                                instance of systemd the special
394
399
                                environment variable
395
 
                                <literal>MANAGERPID</literal> is set
 
400
                                <varname>$MANAGERPID</varname> is set
396
401
                                to the PID of the systemd
397
402
                                instance.</para>
398
403
                                </listitem>
410
415
                                that multiple command lines are allowed
411
416
                                and the commands are executed one
412
417
                                after the other, serially.</para>
 
418
 
 
419
                                <para>If any of those commands (not
 
420
                                prefixed with '<literal>-</literal>')
 
421
                                fail, the rest are not executed and
 
422
                                the unit is considered failed.</para>
413
423
                                </listitem>
414
424
                        </varlistentry>
415
425
 
425
435
                                optional. Specifier and environment
426
436
                                variable substitution is supported
427
437
                                here following the same scheme as for
428
 
                                <varname>ExecStart=</varname>. One
429
 
                                additional special environment
430
 
                                variables is set: if known
431
 
                                <literal>$MAINPID</literal> is set to
 
438
                                <varname>ExecStart=</varname>.</para>
 
439
 
 
440
                                <para>One additional special
 
441
                                environment variables is set: if known
 
442
                                <varname>$MAINPID</varname> is set to
432
443
                                the main process of the daemon, and
433
444
                                may be used for command lines like the
434
 
                                following: <command>/bin/kill -HUP
435
 
                                $MAINPID</command>.</para></listitem>
 
445
                                following:</para>
 
446
 
 
447
                                <programlisting>/bin/kill -HUP $MAINPID</programlisting>
 
448
                                </listitem>
436
449
                        </varlistentry>
437
450
 
438
451
                        <varlistentry>
456
469
                                service stop is requested. Specifier
457
470
                                and environment variable substitution
458
471
                                is supported (including
459
 
                                <literal>$MAINPID</literal>, see
 
472
                                <varname>$MAINPID</varname>, see
460
473
                                above).</para></listitem>
461
474
                        </varlistentry>
462
475
 
464
477
                                <term><varname>ExecStopPost=</varname></term>
465
478
                                <listitem><para>Additional commands
466
479
                                that are executed after the service
467
 
                                was stopped using the commands
468
 
                                configured in
469
 
                                <varname>ExecStop=</varname>. This
 
480
                                was stopped. This includes cases where
 
481
                                the commands configured in
 
482
                                <varname>ExecStop=</varname> were used,
 
483
                                where the service doesn't have any
 
484
                                <varname>ExecStop=</varname> defined, or
 
485
                                where the service exited unexpectedly. This
470
486
                                argument takes multiple command lines,
471
487
                                following the same scheme as described
472
488
                                for <varname>ExecStart</varname>. Use