X-Git-Url: http://git.ipfire.org/?a=blobdiff_plain;f=man%2Fsystemd.service.xml;h=9d0651f5b00407332afbdf2d9097568087dedc3e;hb=514094f933a2b7ba55141bb7ecf867bb28496e9f;hp=b68d351dffcb42894740eebe719d5120a12d8f35;hpb=b8e2400586452499131ff5ab1edb60c1dfbcf92b;p=thirdparty%2Fsystemd.git diff --git a/man/systemd.service.xml b/man/systemd.service.xml index b68d351dffc..9d0651f5b00 100644 --- a/man/systemd.service.xml +++ b/man/systemd.service.xml @@ -1,41 +1,15 @@ - + systemd.service systemd - - - - Developer - Lennart - Poettering - lennart@poettering.net - - @@ -91,55 +65,73 @@ - Implicit Dependencies - - The following dependencies are implicitly added: - - - Services with Type=dbus set automatically - acquire dependencies of type Requires= and - After= on - dbus.socket. - - Socket activated services are automatically ordered after - their activating .socket units via an - automatic After= dependency. - Services also pull in all .socket units - listed in Sockets= via automatic - Wants= and After= dependencies. - - - Additional implicit dependencies may be added as result of - execution and resource control parameters as documented in - systemd.exec5 - and - systemd.resource-control5. + Service Templates + + It is possible for systemd services to take a single argument via the + service@argument.service + syntax. Such services are called "instantiated" services, while the unit definition without the + argument parameter is called a "template". An example could be a + dhcpcd@.service service template which takes a network interface as a + parameter to form an instantiated service. Within the service file, this parameter or "instance + name" can be accessed with %-specifiers. See + systemd.unit5 + for details. - Default Dependencies - - The following dependencies are added unless DefaultDependencies=no is set: - - - Service units will have dependencies of type Requires= and - After= on sysinit.target, a dependency of type After= on - basic.target as well as dependencies of type Conflicts= and - Before= on shutdown.target. These ensure that normal service units pull in - basic system initialization, and are terminated cleanly prior to system shutdown. Only services involved with early - boot or late system shutdown should disable this option. - - Instanced service units (i.e. service units with an @ in their name) are assigned by - default a per-template slice unit (see - systemd.slice5), named after the - template unit, containing all instances of the specific template. This slice is normally stopped at shutdown, - together with all template instances. If that is not desired, set DefaultDependencies=no in the - template unit, and either define your own per-template slice unit file that also sets - DefaultDependencies=no, or set Slice=system.slice (or another suitable slice) - in the template unit. Also see - systemd.resource-control5. - - + Automatic Dependencies + + + Implicit Dependencies + + The following dependencies are implicitly added: + + + Services with Type=dbus set automatically + acquire dependencies of type Requires= and + After= on + dbus.socket. + + Socket activated services are automatically ordered after + their activating .socket units via an + automatic After= dependency. + Services also pull in all .socket units + listed in Sockets= via automatic + Wants= and After= dependencies. + + + Additional implicit dependencies may be added as result of + execution and resource control parameters as documented in + systemd.exec5 + and + systemd.resource-control5. + + + + Default Dependencies + + The following dependencies are added unless DefaultDependencies=no is set: + + + Service units will have dependencies of type Requires= and + After= on sysinit.target, a dependency of type After= on + basic.target as well as dependencies of type Conflicts= and + Before= on shutdown.target. These ensure that normal service units pull in + basic system initialization, and are terminated cleanly prior to system shutdown. Only services involved with early + boot or late system shutdown should disable this option. + + Instanced service units (i.e. service units with an @ in their name) are assigned by + default a per-template slice unit (see + systemd.slice5), named after the + template unit, containing all instances of the specific template. This slice is normally stopped at shutdown, + together with all template instances. If that is not desired, set DefaultDependencies=no in the + template unit, and either define your own per-template slice unit file that also sets + DefaultDependencies=no, or set Slice=system.slice (or another suitable slice) + in the template unit. Also see + systemd.resource-control5. + + + @@ -301,8 +293,9 @@ ExecStop= line set. (Services lacking both ExecStart= and ExecStop= are not valid.) - For each of the specified commands, the first argument must be an absolute path to an - executable. Optionally, this filename may be prefixed with a number of special characters: + For each of the specified commands, the first argument must be either an absolute path to an executable + or a simple file name without any slashes. Optionally, this filename may be prefixed with a number of special + characters: Special executable prefixes @@ -336,7 +329,7 @@ ! - Similar to the + character discussed above this permits invoking command lines with elevated privileges. However, unlike + the ! character exclusively alters the effect of User=, Group= and SupplementaryGroups=, i.e. only the stanzas the affect user and group credentials. Note that this setting may be combined with DynamicUser=, in which case a dynamic user/group pair is allocated before the command is invoked, but credential changing is left to the executed process itself. + Similar to the + character discussed above this permits invoking command lines with elevated privileges. However, unlike + the ! character exclusively alters the effect of User=, Group= and SupplementaryGroups=, i.e. only the stanzas that affect user and group credentials. Note that this setting may be combined with DynamicUser=, in which case a dynamic user/group pair is allocated before the command is invoked, but credential changing is left to the executed process itself. @@ -529,12 +522,12 @@ TimeoutStopSec= - Configures the time to wait for stop. If a - service is asked to stop, but does not terminate in the - specified time, it will be terminated forcibly via - SIGTERM, and after another timeout of - equal duration with SIGKILL (see - KillMode= in + This option serves two purposes. First, it configures the time to wait for each + ExecStop= command. If any of them times out, subsequent ExecStop= commands + are skipped and the service will be terminated by SIGTERM. If no ExecStop= + commands are specified, the service gets the SIGTERM immediately. Second, it configures the time + to wait for the service itself to stop. If it doesn't terminate in the specified time, it will be forcibly terminated + by SIGKILL (see KillMode= in systemd.kill5). Takes a unit-less value in seconds, or a time span value such as "5min 20s". Pass infinity to disable the @@ -575,7 +568,7 @@ must occur before RuntimeMaxSec= is exceeded, and once the runtime has exended beyond RuntimeMaxSec=, the service manager will allow the service to continue to run, provided the service repeats EXTEND_TIMEOUT_USEC=… within the interval specified until the service - shutdown is acheived by STOPPING=1 (or termination). (see + shutdown is achieved by STOPPING=1 (or termination). (see sd_notify3). @@ -931,7 +924,10 @@ passed to the service manager from a specific service are passed back to the service's main process on the next service restart. Any file descriptors passed to the service manager are automatically closed when POLLHUP or POLLERR is seen on them, or when the service is fully - stopped and no job is queued or being executed for it. + stopped and no job is queued or being executed for it. If this option is used, NotifyAccess= + (see above) should be set to open access to the notification socket provided by systemd. If + NotifyAccess= is not set, it will be implicitly set to + . @@ -1004,11 +1000,9 @@ &, and other elements of shell syntax are not supported. - The command to execute must be an absolute path name. It may - contain spaces, but control characters are not allowed. + The command to execute may contain spaces, but control characters are not allowed. - The command line accepts % specifiers as - described in + The command line accepts % specifiers as described in systemd.unit5. Basic environment variable substitution is supported. Use @@ -1022,10 +1016,21 @@ For this type of expansion, quotes are respected when splitting into words, and afterwards removed. + If the command is not a full (absolute) path, it will be resolved to a full path using a + fixed search path determinted at compilation time. Searched directories include + /usr/local/bin/, /usr/bin/, /bin/ + on systems using split /usr/bin/ and /bin/ + directories, and their sbin/ counterparts on systems using split + bin/ and sbin/. It is thus safe to use just the + executable name in case of executables located in any of the "standard" directories, and an + absolute path must be used in other cases. Using an absolute path is recommended to avoid + ambiguity. Hint: this search path may be queried using + systemd-path search-binaries-default. + Example: Environment="ONE=one" 'TWO=two two' -ExecStart=/bin/echo $ONE $TWO ${TWO} +ExecStart=echo $ONE $TWO ${TWO} This will execute /bin/echo with four arguments: one, two, @@ -1035,7 +1040,7 @@ ExecStart=/bin/echo $ONE $TWO ${TWO} Environment=ONE='one' "TWO='two two' too" THREE= ExecStart=/bin/echo ${ONE} ${TWO} ${THREE} ExecStart=/bin/echo $ONE $TWO $THREE - This results in echo being + This results in /bin/echo being called twice, the first time with arguments 'one', 'two two' too, , @@ -1061,27 +1066,27 @@ ExecStart=/bin/echo $ONE $TWO $THREE Note that shell command lines are not directly supported. If shell command lines are to be used, they need to be passed explicitly to a shell implementation of some kind. Example: - ExecStart=/bin/sh -c 'dmesg | tac' + ExecStart=sh -c 'dmesg | tac' Example: - ExecStart=/bin/echo one ; /bin/echo "two two" + ExecStart=echo one ; echo "two two" - This will execute /bin/echo two times, + This will execute echo two times, each time with one argument: one and two two, respectively. Because two commands are specified, Type=oneshot must be used. Example: - ExecStart=/bin/echo / >/dev/null & \; \ -/bin/ls + ExecStart=echo / >/dev/null & \; \ +ls - This will execute /bin/echo + This will execute echo with five arguments: /, >/dev/null, &, ;, and - /bin/ls. + ls.
C escapes supported in command lines and environment variables