]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.service.xml
man: always supply quotes around literals
[thirdparty/systemd.git] / man / systemd.service.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
2 <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?>
3 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
4 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
5
6 <!--
7 This file is part of systemd.
8
9 Copyright 2010 Lennart Poettering
10
11 systemd is free software; you can redistribute it and/or modify it
12 under the terms of the GNU Lesser General Public License as published by
13 the Free Software Foundation; either version 2.1 of the License, or
14 (at your option) any later version.
15
16 systemd is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 Lesser General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with systemd; If not, see <http://www.gnu.org/licenses/>.
23 -->
24
25 <refentry id="systemd.service">
26 <refentryinfo>
27 <title>systemd.service</title>
28 <productname>systemd</productname>
29
30 <authorgroup>
31 <author>
32 <contrib>Developer</contrib>
33 <firstname>Lennart</firstname>
34 <surname>Poettering</surname>
35 <email>lennart@poettering.net</email>
36 </author>
37 </authorgroup>
38 </refentryinfo>
39
40 <refmeta>
41 <refentrytitle>systemd.service</refentrytitle>
42 <manvolnum>5</manvolnum>
43 </refmeta>
44
45 <refnamediv>
46 <refname>systemd.service</refname>
47 <refpurpose>Service unit configuration</refpurpose>
48 </refnamediv>
49
50 <refsynopsisdiv>
51 <para><filename><replaceable>service</replaceable>.service</filename></para>
52 </refsynopsisdiv>
53
54 <refsect1>
55 <title>Description</title>
56
57 <para>A unit configuration file whose name ends in
58 <filename>.service</filename> encodes information
59 about a process controlled and supervised by
60 systemd.</para>
61
62 <para>This man page lists the configuration options
63 specific to this unit type. See
64 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
65 for the common options of all unit configuration
66 files. The common configuration items are configured
67 in the generic <literal>[Unit]</literal> and
68 <literal>[Install]</literal> sections. The service
69 specific configuration options are configured in the
70 <literal>[Service]</literal> section.</para>
71
72 <para>Additional options are listed in
73 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
74 which define the execution environment the commands
75 are executed in, and in
76 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
77 which define the way the processes of the service are
78 terminated.</para>
79
80 <para>Unless <varname>DefaultDependencies=</varname>
81 is set to <option>false</option>, service units will
82 implicitly have dependencies of type
83 <varname>Requires=</varname> and
84 <varname>After=</varname> on
85 <filename>basic.target</filename> as well as
86 dependencies of type <varname>Conflicts=</varname> and
87 <varname>Before=</varname> on
88 <filename>shutdown.target</filename>. These ensure
89 that normal service units pull in basic system
90 initialization, and are terminated cleanly prior to
91 system shutdown. Only services involved with early
92 boot or late system shutdown should disable this
93 option.</para>
94
95 <para>If a service is requested under a certain name
96 but no unit configuration file is found, systemd looks
97 for a SysV init script by the same name (with the
98 <filename>.service</filename> suffix removed) and
99 dynamically creates a service unit from that
100 script. This is useful for compatibility with
101 SysV. Note that this compatibility is quite
102 comprehensive but not 100%. For details about the
103 incompatibilities see the <ulink
104 url="http://www.freedesktop.org/wiki/Software/systemd/Incompatibilities">Incompatibilities
105 with SysV</ulink> document.
106 </para>
107 </refsect1>
108
109 <refsect1>
110 <title>Options</title>
111
112 <para>Service files must include a
113 <literal>[Service]</literal> section, which carries
114 information about the service and the process it
115 supervises. A number of options that may be used in
116 this section are shared with other unit types. These
117 options are documented in
118 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
119 and
120 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>. The
121 options specific to the <literal>[Service]</literal>
122 section of service units are the following:</para>
123
124 <variablelist class='unit-directives'>
125 <varlistentry>
126 <term><varname>Type=</varname></term>
127
128 <listitem><para>Configures the process
129 start-up type for this service
130 unit. One of <option>simple</option>,
131 <option>forking</option>,
132 <option>oneshot</option>,
133 <option>dbus</option>,
134 <option>notify</option> or
135 <option>idle</option>.</para>
136
137 <para>If set to
138 <option>simple</option> (the default
139 value if <varname>BusName=</varname>
140 is not specified) it is expected that
141 the process configured with
142 <varname>ExecStart=</varname> is the
143 main process of the service. In this
144 mode, if the process offers
145 functionality to other processes on
146 the system its communication channels
147 should be installed before the daemon
148 is started up (e.g. sockets set up by
149 systemd, via socket activation), as
150 systemd will immediately proceed
151 starting follow-up units.</para>
152
153 <para>If set to
154 <option>forking</option> it is
155 expected that the process configured
156 with <varname>ExecStart=</varname>
157 will call <function>fork()</function>
158 as part of its start-up. The parent process is
159 expected to exit when start-up is
160 complete and all communication
161 channels set up. The child continues
162 to run as the main daemon
163 process. This is the behavior of
164 traditional UNIX daemons. If this
165 setting is used, it is recommended to
166 also use the
167 <varname>PIDFile=</varname> option, so
168 that systemd can identify the main
169 process of the daemon. systemd will
170 proceed starting follow-up units as
171 soon as the parent process
172 exits.</para>
173
174 <para>Behavior of
175 <option>oneshot</option> is similar
176 to <option>simple</option>, however
177 it is expected that the process has to
178 exit before systemd starts follow-up
179 units. <varname>RemainAfterExit=</varname>
180 is particularly useful for this type
181 of service.</para>
182
183 <para>Behavior of
184 <option>dbus</option> is similar to
185 <option>simple</option>, however it is
186 expected that the daemon acquires a
187 name on the D-Bus bus, as configured
188 by
189 <varname>BusName=</varname>. systemd
190 will proceed starting follow-up units
191 after the D-Bus bus name has been
192 acquired. Service units with this
193 option configured implicitly gain
194 dependencies on the
195 <filename>dbus.socket</filename>
196 unit. This type is the default if
197 <varname>BusName=</varname> is
198 specified.</para>
199
200 <para>Behavior of
201 <option>notify</option> is similar to
202 <option>simple</option>, however it is
203 expected that the daemon sends a
204 notification message via
205 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
206 or an equivalent call when it finished
207 starting up. systemd will proceed
208 starting follow-up units after this
209 notification message has been sent. If
210 this option is used
211 <varname>NotifyAccess=</varname> (see
212 below) should be set to open access to
213 the notification socket provided by
214 systemd. If
215 <varname>NotifyAccess=</varname> is
216 not set, it will be implicitly set to
217 <option>main</option>.</para>
218
219 <para>Behavior of
220 <option>idle</option> is very similar
221 to <option>simple</option>, however
222 actual execution of the service
223 binary is delayed until all jobs are
224 dispatched. This may be used to avoid
225 interleaving of output of shell
226 services with the status output on the
227 console.</para>
228 </listitem>
229 </varlistentry>
230
231 <varlistentry>
232 <term><varname>RemainAfterExit=</varname></term>
233
234 <listitem><para>Takes a boolean value
235 that specifies whether the service
236 shall be considered active even when
237 all its processes exited. Defaults to
238 <option>no</option>.</para>
239 </listitem>
240 </varlistentry>
241
242 <varlistentry>
243 <term><varname>GuessMainPID=</varname></term>
244
245 <listitem><para>Takes a boolean value
246 that specifies whether systemd should
247 try to guess the main PID of a service
248 if it cannot be determined
249 reliably. This option is ignored
250 unless <option>Type=forking</option>
251 is set and <option>PIDFile=</option>
252 is unset because for the other types
253 or with an explicitly configured PID
254 file the main PID is always known. The
255 guessing algorithm might come to
256 incorrect conclusions if a daemon
257 consists of more than one process. If
258 the main PID cannot be determined
259 failure detection and automatic
260 restarting of a service will not work
261 reliably. Defaults to
262 <option>yes</option>.</para>
263 </listitem>
264 </varlistentry>
265
266 <varlistentry>
267 <term><varname>PIDFile=</varname></term>
268
269 <listitem><para>Takes an absolute file
270 name pointing to the PID file of this
271 daemon. Use of this option is
272 recommended for services where
273 <varname>Type=</varname> is set to
274 <option>forking</option>. systemd will
275 read the PID of the main process of
276 the daemon after start-up of the
277 service. systemd will not write to the
278 file configured here.</para>
279 </listitem>
280 </varlistentry>
281
282 <varlistentry>
283 <term><varname>BusName=</varname></term>
284
285 <listitem><para>Takes a D-Bus bus
286 name, that this service is reachable
287 as. This option is mandatory for
288 services where
289 <varname>Type=</varname> is set to
290 <option>dbus</option>, but its use
291 is otherwise recommended as well if
292 the process takes a name on the D-Bus
293 bus.</para>
294 </listitem>
295 </varlistentry>
296
297 <varlistentry>
298 <term><varname>ExecStart=</varname></term>
299 <listitem><para>Commands with their
300 arguments that are executed when this
301 service is started. The first
302 argument must be an absolute path
303 name.</para>
304
305 <para>When <varname>Type</varname> is
306 not <option>oneshot</option>, only one
307 command may be given. When
308 <varname>Type=oneshot</varname> is
309 used, more than one command may be
310 specified. Multiple command lines may
311 be concatenated in a single directive,
312 by separating them with semicolons
313 (these semicolons must be passed as
314 separate words). Alternatively, this
315 directive may be specified more than
316 once with the same effect. However,
317 the latter syntax is not recommended
318 for compatibility with parsers
319 suitable for XDG
320 <filename>.desktop</filename> files.
321 Lone semicolons may be escaped as
322 <literal>\;</literal>. If the empty
323 string is assigned to this option the
324 list of commands to start is reset,
325 prior assignments of this option will
326 have no effect.</para>
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
337 <para>Unless
338 <varname>Type=forking</varname> is
339 set, the process started via this
340 command line will be considered the
341 main process of the daemon.</para>
342
343 <para>The command line accepts
344 <literal>%</literal> specifiers as
345 described in
346 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Note
347 that the first argument of the command
348 line (i.e. the program to execute) may
349 not include specifiers.</para>
350
351 <para>Basic environment variable
352 substitution is supported. Use
353 <literal>${FOO}</literal> as part of a
354 word, or as a word of its own on the
355 command line, in which case it will be
356 replaced by the value of the
357 environment variable including all
358 whitespace it contains, resulting in a
359 single argument. Use
360 <literal>$FOO</literal> as a separate
361 word on the command line, in which
362 case it will be replaced by the value
363 of the environment variable split up
364 at whitespace, resulting in zero or
365 more arguments. Note that the first
366 argument (i.e. the program to execute)
367 may not be a variable, since it must
368 be a literal and absolute path
369 name.</para>
370
371 <para>Optionally, if the absolute file
372 name is prefixed with
373 <literal>@</literal>, the second token
374 will be passed as
375 <literal>argv[0]</literal> to the
376 executed process, followed by the
377 further arguments specified. If the
378 absolute file name is prefixed with
379 <literal>-</literal> an exit code of
380 the command normally considered a
381 failure (i.e. non-zero exit status or
382 abnormal exit due to signal) is ignored
383 and considered success. If both
384 <literal>-</literal> and
385 <literal>@</literal> are used they
386 can appear in either order.</para>
387
388 <para>Note that this setting does not
389 directly support shell command
390 lines. If shell command lines are to
391 be used they need to be passed
392 explicitly to a shell implementation
393 of some kind. Example:</para>
394 <programlisting>ExecStart=/bin/sh -c 'dmesg | tac'
395 </programlisting>
396
397 <para>For services run by a user
398 instance of systemd the special
399 environment variable
400 <varname>$MANAGERPID</varname> is set
401 to the PID of the systemd
402 instance.</para>
403 </listitem>
404 </varlistentry>
405
406 <varlistentry>
407 <term><varname>ExecStartPre=</varname></term>
408 <term><varname>ExecStartPost=</varname></term>
409 <listitem><para>Additional commands
410 that are executed before or after
411 the command in
412 <varname>ExecStart=</varname>, respectively.
413 Syntax is the same as for
414 <varname>ExecStart=</varname>, except
415 that multiple command lines are allowed
416 and the commands are executed one
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>
423 </listitem>
424 </varlistentry>
425
426 <varlistentry>
427 <term><varname>ExecReload=</varname></term>
428 <listitem><para>Commands to execute to
429 trigger a configuration reload in the
430 service. This argument takes multiple
431 command lines, following the same
432 scheme as described for
433 <varname>ExecStart=</varname>
434 above. Use of this setting is
435 optional. Specifier and environment
436 variable substitution is supported
437 here following the same scheme as for
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
443 the main process of the daemon, and
444 may be used for command lines like the
445 following:</para>
446
447 <programlisting>/bin/kill -HUP $MAINPID</programlisting>
448 </listitem>
449 </varlistentry>
450
451 <varlistentry>
452 <term><varname>ExecStop=</varname></term>
453 <listitem><para>Commands to execute to
454 stop the service started via
455 <varname>ExecStart=</varname>. This
456 argument takes multiple command lines,
457 following the same scheme as described
458 for <varname>ExecStart=</varname>
459 above. Use of this setting is
460 optional. All processes remaining for
461 a service after the commands
462 configured in this option are run are
463 terminated according to the
464 <varname>KillMode=</varname> setting
465 (see
466 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>). If
467 this option is not specified the
468 process is terminated right-away when
469 service stop is requested. Specifier
470 and environment variable substitution
471 is supported (including
472 <varname>$MAINPID</varname>, see
473 above).</para></listitem>
474 </varlistentry>
475
476 <varlistentry>
477 <term><varname>ExecStopPost=</varname></term>
478 <listitem><para>Additional commands
479 that are executed after the service
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
486 argument takes multiple command lines,
487 following the same scheme as described
488 for <varname>ExecStart</varname>. Use
489 of these settings is
490 optional. Specifier and environment
491 variable substitution is
492 supported.</para></listitem>
493 </varlistentry>
494
495 <varlistentry>
496 <term><varname>RestartSec=</varname></term>
497 <listitem><para>Configures the time to
498 sleep before restarting a service (as
499 configured with
500 <varname>Restart=</varname>). Takes a
501 unit-less value in seconds, or a time
502 span value such as "5min
503 20s". Defaults to
504 100ms.</para></listitem>
505 </varlistentry>
506
507 <varlistentry>
508 <term><varname>TimeoutStartSec=</varname></term>
509 <listitem><para>Configures the time to
510 wait for start-up. If a
511 daemon service does not signal
512 start-up completion within the
513 configured time, the service will be
514 considered failed and be shut down
515 again.
516 Takes a unit-less value in seconds, or a
517 time span value such as "5min
518 20s". Pass 0 to disable the timeout
519 logic. Defaults to 90s, except when
520 <varname>Type=oneshot</varname> is
521 used in which case the timeout
522 is disabled by default.
523 </para></listitem>
524 </varlistentry>
525
526 <varlistentry>
527 <term><varname>TimeoutStopSec=</varname></term>
528 <listitem><para>Configures the time to
529 wait for stop. If a service is asked
530 to stop but does not terminate in the
531 specified time, it will be terminated
532 forcibly via SIGTERM, and after
533 another delay of this time with
534 SIGKILL (See
535 <varname>KillMode=</varname>
536 in <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>).
537 Takes a unit-less value in seconds, or a
538 time span value such as "5min
539 20s". Pass 0 to disable the timeout
540 logic. Defaults to 90s.
541 </para></listitem>
542 </varlistentry>
543
544 <varlistentry>
545 <term><varname>TimeoutSec=</varname></term>
546 <listitem><para>A shorthand for configuring
547 both <varname>TimeoutStartSec=</varname>
548 and <varname>TimeoutStopSec=</varname>
549 to the specified value.
550 </para></listitem>
551 </varlistentry>
552
553 <varlistentry>
554 <term><varname>WatchdogSec=</varname></term>
555 <listitem><para>Configures the
556 watchdog timeout for a service. The
557 watchdog is activated when the start-up is
558 completed. The service must call
559 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
560 regularly with "WATCHDOG=1" (i.e. the
561 "keep-alive ping"). If the time
562 between two such calls is larger than
563 the configured time then the service
564 is placed in a failure state. By
565 setting <varname>Restart=</varname> to
566 <option>on-failure</option> or
567 <option>always</option> the service
568 will be automatically restarted. The
569 time configured here will be passed to
570 the executed service process in the
571 <varname>WATCHDOG_USEC=</varname>
572 environment variable. This allows
573 daemons to automatically enable the
574 keep-alive pinging logic if watchdog
575 support is enabled for the service. If
576 this option is used
577 <varname>NotifyAccess=</varname> (see
578 below) should be set to open access to
579 the notification socket provided by
580 systemd. If
581 <varname>NotifyAccess=</varname> is
582 not set, it will be implicitly set to
583 <option>main</option>. Defaults to 0,
584 which disables this
585 feature.</para></listitem>
586 </varlistentry>
587
588 <varlistentry>
589 <term><varname>Restart=</varname></term>
590 <listitem><para>Configures whether the
591 service shall be restarted when the
592 service process exits, is killed,
593 or a timeout is reached. The service
594 process may be the main service
595 process, but also one of the processes
596 specified with
597 <varname>ExecStartPre=</varname>,
598 <varname>ExecStartPost=</varname>,
599 <varname>ExecStopPre=</varname>,
600 <varname>ExecStopPost=</varname>, or
601 <varname>ExecReload=</varname>.
602 When the death of the process is a
603 result of systemd operation (e.g. service
604 stop or restart), the service will not be
605 restarted. Timeouts include missing
606 the watchdog "keep-alive ping"
607 deadline and a service start, reload,
608 and stop operation timeouts.</para>
609
610 <para>Takes one of
611 <option>no</option>,
612 <option>on-success</option>,
613 <option>on-failure</option>,
614 <option>on-abort</option>, or
615 <option>always</option>. If set to
616 <option>no</option> (the default) the
617 service will not be restarted. If set to
618 <option>on-success</option> it will be
619 restarted only when the service process
620 exits cleanly.
621 In this context, a clean exit means
622 an exit code of 0, or one of the signals
623 SIGHUP, SIGINT, SIGTERM, or SIGPIPE, and
624 additionally, exit statuses and signals
625 specified in <varname>SuccessExitStatus=</varname>.
626 If set to <option>on-failure</option>
627 the service will be restarted when the
628 process exits with an nonzero exit code,
629 is terminated by a signal (including on
630 core dump), when an operation (such as
631 service reload) times out, and when the
632 configured watchdog timeout is triggered.
633 If set to
634 <option>on-abort</option> the service
635 will be restarted only if the service
636 process exits due to an uncaught
637 signal not specified as a clean exit
638 status.
639 If set to
640 <option>always</option> the service
641 will be restarted regardless whether
642 it exited cleanly or not, got
643 terminated abnormally by a signal or
644 hit a timeout.</para>
645
646 <para>In addition to the above settings,
647 the service will not be restarted if the
648 exit code or signal is specified in
649 <varname>RestartPreventExitStatus=</varname>
650 (see below).</para></listitem>
651 </varlistentry>
652
653 <varlistentry>
654 <term><varname>SuccessExitStatus=</varname></term>
655 <listitem><para>Takes a list of exit
656 status definitions that when returned
657 by the main service process will be
658 considered successful termination, in
659 addition to the normal successful exit
660 code 0 and the signals SIGHUP, SIGINT,
661 SIGTERM and SIGPIPE. Exit status
662 definitions can either be numeric exit
663 codes or termination signal names,
664 separated by spaces. Example:
665 <literal>SuccessExitStatus=1 2 8
666 SIGKILL</literal>, ensures that exit
667 codes 1, 2, 8 and the termination
668 signal SIGKILL are considered clean
669 service terminations. This option may
670 appear more than once in which case
671 the list of successful exit statuses
672 is merged. If the empty string is
673 assigned to this option the list is
674 reset, all prior assignments of this
675 option will have no
676 effect.</para></listitem>
677 </varlistentry>
678
679 <varlistentry>
680 <term><varname>RestartPreventExitStatus=</varname></term>
681 <listitem><para>Takes a list of exit
682 status definitions that when returned
683 by the main service process will
684 prevent automatic service restarts
685 regardless of the restart setting
686 configured with
687 <varname>Restart=</varname>. Exit
688 status definitions can either be
689 numeric exit codes or termination
690 signal names, and are separated by
691 spaces. Defaults to the empty list, so
692 that by default no exit status is
693 excluded from the configured restart
694 logic. Example:
695 <literal>RestartPreventExitStatus=1 6
696 SIGABRT</literal>, ensures that exit
697 codes 1 and 6 and the termination
698 signal SIGABRT will not result in
699 automatic service restarting. This
700 option may appear more than once in
701 which case the list of restart preventing
702 statuses is merged. If the empty
703 string is assigned to this option the
704 list is reset, all prior assignments
705 of this option will have no
706 effect.</para></listitem>
707 </varlistentry>
708
709 <varlistentry>
710 <term><varname>PermissionsStartOnly=</varname></term>
711 <listitem><para>Takes a boolean
712 argument. If true, the permission
713 related execution options as
714 configured with
715 <varname>User=</varname> and similar
716 options (see
717 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
718 for more information) are only applied
719 to the process started with
720 <varname>ExecStart=</varname>, and not
721 to the various other
722 <varname>ExecStartPre=</varname>,
723 <varname>ExecStartPost=</varname>,
724 <varname>ExecReload=</varname>,
725 <varname>ExecStop=</varname>,
726 <varname>ExecStopPost=</varname>
727 commands. If false, the setting is
728 applied to all configured commands the
729 same way. Defaults to
730 false.</para></listitem>
731 </varlistentry>
732
733 <varlistentry>
734 <term><varname>RootDirectoryStartOnly=</varname></term>
735 <listitem><para>Takes a boolean
736 argument. If true, the root directory
737 as configured with the
738 <varname>RootDirectory=</varname>
739 option (see
740 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
741 for more information) is only applied
742 to the process started with
743 <varname>ExecStart=</varname>, and not
744 to the various other
745 <varname>ExecStartPre=</varname>,
746 <varname>ExecStartPost=</varname>,
747 <varname>ExecReload=</varname>,
748 <varname>ExecStop=</varname>,
749 <varname>ExecStopPost=</varname>
750 commands. If false, the setting is
751 applied to all configured commands the
752 same way. Defaults to
753 false.</para></listitem>
754 </varlistentry>
755
756 <varlistentry>
757 <term><varname>NonBlocking=</varname></term>
758 <listitem><para>Set O_NONBLOCK flag
759 for all file descriptors passed via
760 socket-based activation. If true, all
761 file descriptors >= 3 (i.e. all except
762 STDIN/STDOUT/STDERR) will have
763 the O_NONBLOCK flag set and hence are in
764 non-blocking mode. This option is only
765 useful in conjunction with a socket
766 unit, as described in
767 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>. Defaults
768 to false.</para></listitem>
769 </varlistentry>
770
771 <varlistentry>
772 <term><varname>NotifyAccess=</varname></term>
773 <listitem><para>Controls access to the
774 service status notification socket, as
775 accessible via the
776 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>
777 call. Takes one of
778 <option>none</option> (the default),
779 <option>main</option> or
780 <option>all</option>. If
781 <option>none</option> no daemon status
782 updates are accepted from the service
783 processes, all status update messages
784 are ignored. If <option>main</option>
785 only service updates sent from the
786 main process of the service are
787 accepted. If <option>all</option> all
788 services updates from all members of
789 the service's control group are
790 accepted. This option should be set to
791 open access to the notification socket
792 when using
793 <varname>Type=notify</varname> or
794 <varname>WatchdogSec=</varname> (see
795 above). If those options are used but
796 <varname>NotifyAccess=</varname> not
797 configured it will be implicitly set
798 to
799 <option>main</option>.</para></listitem>
800 </varlistentry>
801
802 <varlistentry>
803 <term><varname>Sockets=</varname></term>
804 <listitem><para>Specifies the name of
805 the socket units this service shall
806 inherit the sockets from when the
807 service is started. Normally it
808 should not be necessary to use this
809 setting as all sockets whose unit
810 shares the same name as the service
811 (ignoring the different suffix of course)
812 are passed to the spawned
813 process.</para>
814
815 <para>Note that the same socket may be
816 passed to multiple processes at the
817 same time. Also note that a different
818 service may be activated on incoming
819 traffic than inherits the sockets. Or
820 in other words: the
821 <varname>Service=</varname> setting of
822 <filename>.socket</filename> units
823 doesn't have to match the inverse of
824 the <varname>Sockets=</varname>
825 setting of the
826 <filename>.service</filename> it
827 refers to.</para>
828
829 <para>This option may appear more than
830 once, in which case the list of socket
831 units is merged. If the empty string
832 is assigned to this option the list of
833 sockets is reset, all prior uses of
834 this setting will have no
835 effect.</para></listitem>
836 </varlistentry>
837
838 <varlistentry>
839 <term><varname>StartLimitInterval=</varname></term>
840 <term><varname>StartLimitBurst=</varname></term>
841
842 <listitem><para>Configure service
843 start rate limiting. By default
844 services which are started more often
845 than 5 times within 10s are not
846 permitted to start any more times
847 until the 10s interval ends. With
848 these two options this rate limiting
849 may be modified. Use
850 <varname>StartLimitInterval=</varname>
851 to configure the checking interval
852 (defaults to 10s, set to 0 to disable
853 any kind of rate limiting). Use
854 <varname>StartLimitBurst=</varname> to
855 configure how many starts per interval
856 are allowed (defaults to 5). These
857 configuration options are particularly
858 useful in conjunction with
859 <varname>Restart=</varname>, however
860 apply to all kinds of starts
861 (including manual), not just those
862 triggered by the
863 <varname>Restart=</varname> logic.
864 Note that units which are configured
865 for <varname>Restart=</varname> and
866 which reach the start limit are not
867 attempted to be restarted anymore,
868 however they may still be restarted
869 manually at a later point from which
870 point on the restart logic is again
871 activated. Note that
872 <command>systemctl
873 reset-failed</command> will cause the
874 restart rate counter for a service to
875 be flushed, which is useful if the
876 administrator wants to manually start
877 a service and the start limit
878 interferes with
879 that.</para></listitem>
880 </varlistentry>
881
882 <varlistentry>
883 <term><varname>StartLimitAction=</varname></term>
884
885 <listitem><para>Configure the action
886 to take if the rate limit configured
887 with
888 <varname>StartLimitInterval=</varname>
889 and
890 <varname>StartLimitBurst=</varname> is
891 hit. Takes one of
892 <option>none</option>,
893 <option>reboot</option>,
894 <option>reboot-force</option> or
895 <option>reboot-immediate</option>. If
896 <option>none</option> is set,
897 hitting the rate limit will trigger no
898 action besides that the start will not
899 be
900 permitted. <option>reboot</option>
901 causes a reboot following the normal
902 shutdown procedure (i.e. equivalent to
903 <command>systemctl reboot</command>),
904 <option>reboot-force</option> causes
905 an forced reboot which will terminate
906 all processes forcibly but should
907 cause no dirty file systems on reboot
908 (i.e. equivalent to <command>systemctl
909 reboot -f</command>) and
910 <option>reboot-immediate</option>
911 causes immediate execution of the
912 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
913 system call, which might result in
914 data loss. Defaults to
915 <option>none</option>.</para></listitem>
916 </varlistentry>
917
918 </variablelist>
919
920 <para>Check
921 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
922 and
923 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>
924 for more settings.</para>
925
926 </refsect1>
927
928 <refsect1>
929 <title>Compatibility Options</title>
930
931 <para>The following options are also available in the
932 <literal>[Service]</literal> section, but exist purely
933 for compatibility reasons and should not be used in
934 newly written service files.</para>
935
936 <variablelist class='unit-directives'>
937 <varlistentry>
938 <term><varname>SysVStartPriority=</varname></term>
939 <listitem><para>Set the SysV start
940 priority to use to order this service
941 in relation to SysV services lacking
942 LSB headers. This option is only
943 necessary to fix ordering in relation
944 to legacy SysV services, that have no
945 ordering information encoded in the
946 script headers. As such it should only
947 be used as temporary compatibility
948 option, and not be used in new unit
949 files. Almost always it is a better
950 choice to add explicit ordering
951 directives via
952 <varname>After=</varname> or
953 <varname>Before=</varname>,
954 instead. For more details see
955 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
956 used, pass an integer value in the
957 range 0-99.</para></listitem>
958 </varlistentry>
959
960 <varlistentry>
961 <term><varname>FsckPassNo=</varname></term>
962 <listitem><para>Set the fsck passno
963 priority to use to order this service
964 in relation to other file system
965 checking services. This option is only
966 necessary to fix ordering in relation
967 to fsck jobs automatically created for
968 all <filename>/etc/fstab</filename>
969 entries with a value in the fs_passno
970 column > 0. As such it should only be
971 used as option for fsck
972 services. Almost always it is a better
973 choice to add explicit ordering
974 directives via
975 <varname>After=</varname> or
976 <varname>Before=</varname>,
977 instead. For more details see
978 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>. If
979 used, pass an integer value in the
980 same range as
981 <filename>/etc/fstab</filename>'s
982 fs_passno column. See
983 <citerefentry><refentrytitle>fstab</refentrytitle><manvolnum>5</manvolnum></citerefentry>
984 for details.</para></listitem>
985 </varlistentry>
986
987 </variablelist>
988 </refsect1>
989
990 <refsect1>
991 <title>See Also</title>
992 <para>
993 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
994 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
995 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
996 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
997 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
998 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>
999 </para>
1000 </refsect1>
1001
1002 </refentry>