Linux Service Unit File Format
- just description
- ususlly a link to the official website
- lists any units upon which this unit essentially depends
- the current unit starts when the required units are actived successfully
- required units are started in parallel by default
- similar to
Requires=, but less strict
- The systemd will attempt to start any units listed by
Wants=when the current unit is actived. If wanted units are not found or failed to start, the current unit will continue to function.
- Wanted units are started in parallel unless modified by other directives.
- similar to
Requires=, but also causes the current unit to stop when the associated unit terminates.
- specifes units that will not be started unitl the current unit is marked as started
- does not imply a dependency relationship
- specifies units that should be started before the current unit
- lists units that cannot be run at the same time as the current unit
- can be used to provide a generic unit file that will only be run when on appropriate systems
- similar to
- a negative result causes a failure with this directive
- simple: The main process of the service is specified in the start line.
- forking: The service forks a child process and the parent process exits almost immediately. This type tells the systemd the service is sitll running even though the parent process exited.
- onshot: The service will be short-lived and that systemd should wait for the process to exit before continuing on with other units. Used for one-off tasks.
- dbus: The unit will take a name on the D-Bus bus.
- notify: The service will issue a notification when it has finished staring up. The systemd process will wait for this to happen before proceeding to other units.
- idle: The serivce will not be run until all jobs are dispatched.
- specifies how a unit should be enabled
- When enabled, a directory will be created within
/etc/systemd/systemnamed after the specified unit with
.wantsappended to the end. A symbolic link to the current unit will be created, creating the dependency.
- For example, if the current unit has
WantedBy=multi-user.target, a directory called
multi-user.target.wantswill be created within
/etc/systemd/systemand a symbolic link to the current unit will be placed within.
- Disabling the unit removes the link and removes the dependency relationship.
- similar to the
WantedBydirective, but instead specifies a required dependency that will cause the activation to fail if not met
- When enabled, a unit with this directive will create a directory ending with
- allows units to be enabled under another name as well
- allows units to be enabled or disabled as a set
- For template units (covered later) which can produce unit instances with unpredictable names, this can be used as a fallback value for the name if an appropriate name is not provided.