From 625e7467634a9c9649207c6db8d03300d9f567fd Mon Sep 17 00:00:00 2001 From: Christopher Engelhard Date: Wed, 5 Aug 2020 17:59:16 +0200 Subject: [PATCH] formatting, small errors, minor rewords & clarifications --- .../_partials/con_understanding-systemd.adoc | 14 +++++++------- .../proc_converting-sysvinit-services.adoc | 14 +++++++------- .../proc_creating-new-systemd-services.adoc | 19 +++++++++++++------ ...c_modifying-existing-systemd-services.adoc | 2 +- ...topping-and-querying-systemd-services.adoc | 10 +++++----- .../ref_common-service-parameters.adoc | 14 +++++++------- .../ref_mapping-runlevel-to-targets.adoc | 8 ++++---- .../ref_mapping-service-commands.adoc | 6 +++--- ...derstanding-and-administering-systemd.adoc | 8 ++++---- 9 files changed, 51 insertions(+), 44 deletions(-) diff --git a/modules/ROOT/pages/_partials/con_understanding-systemd.adoc b/modules/ROOT/pages/_partials/con_understanding-systemd.adoc index a149d19..0c9bb30 100644 --- a/modules/ROOT/pages/_partials/con_understanding-systemd.adoc +++ b/modules/ROOT/pages/_partials/con_understanding-systemd.adoc @@ -1,7 +1,7 @@ [id='understanding-systemd'] = Understanding systemd -systemd is a system and service manager for Linux, compatible with SysV and LSB init scripts. systemd provides: +_systemd_ is a system and service manager for Linux, compatible with SysV and LSB init scripts. _systemd_ provides: * Aggressive parallelization capabilities * Uses socket and D-Bus activation for starting services @@ -10,9 +10,9 @@ systemd is a system and service manager for Linux, compatible with SysV and LSB * Maintains mount and automount points * Implements an elaborate transactional dependency-based service control logic. -The `systemctl` command is the primary tool to manage systemd. It combines the functionality of SysVinit's `service` and `chkconfig` commands into a single tool you can use to enable and disable services permanently or only for the current session. +The `systemctl` command is the primary tool to manage _systemd_. It combines the functionality of SysVinit's `service` and `chkconfig` commands into a single tool you can use to enable and disable services permanently or only for the current session. -systemd manages _units_, which are representations of system resources and services. This following list shows the unit types that systemd can manage: +_systemd_ manages so-called *_units_*, which are representations of system resources and services. This following list shows the unit types that _systemd_ can manage: service:: A service on the system, including instructions for starting, restarting, and stopping the service. @@ -21,10 +21,10 @@ socket:: A network socket associated with a service. device:: - A device specifically managed with systemd. + A device specifically managed with _systemd_. mount:: - A mountpoint managed with systemd. + A mountpoint managed with _systemd_. automount:: A mountpoint automatically mounted on boot. @@ -42,10 +42,10 @@ timer:: A timer to schedule activation of another unit. snapshot:: - A snapshot of the current systemd state. Usually used to rollback after making temporary changes to systemd. + A snapshot of the current _systemd_ state. Usually used to rollback after making temporary changes to _systemd_. slice:: Restriction of resources through Linux Control Group nodes (cgroups). scope:: - Information from systemd bus interfaces. Usually used to manage external system processes. + Information from _systemd_ bus interfaces. Usually used to manage external system processes. diff --git a/modules/ROOT/pages/_partials/proc_converting-sysvinit-services.adoc b/modules/ROOT/pages/_partials/proc_converting-sysvinit-services.adoc index 5e70ad2..6597ae2 100644 --- a/modules/ROOT/pages/_partials/proc_converting-sysvinit-services.adoc +++ b/modules/ROOT/pages/_partials/proc_converting-sysvinit-services.adoc @@ -1,14 +1,14 @@ [#converting-sysvinit-services] -= Converting SysVinit services += Converting SysVinit services to systemd -Older versions of Fedora use SysVinit scripts to manage services. This section provides some guidelines on how to convert a SysVinit script to a systemd equivalent. +Older versions of Fedora use SysVinit scripts to manage services. This section provides some guidelines on how to convert a SysVinit script to a _systemd_ equivalent. [discrete] == Prerequisites * You are logged in as a user with administrator-level permissions. -* You have a custom SysVinit script to convert to a systemd configuration. +* You have a custom SysVinit script to convert to a _systemd_ configuration. [discrete] == Procedure @@ -19,14 +19,14 @@ Older versions of Fedora use SysVinit scripts to manage services. This section p # chkconfig: 235 20 80 ---- + -systemd uses targets instead of runlevels. Use the table in <<#converting-sysvinit-services>> to map the runlevels to targets. In this example, runlevels 2, 3, and 5 are all multi-user runlevels, so the systemd service can use the following: +systemd uses targets instead of runlevels. Use the table in <<#converting-sysvinit-services>> to map the runlevels to targets. In this example, runlevels 2, 3, and 5 are all multi-user runlevels, so the _systemd_ service can use the following: + ---- [Install] WantedBy=multi-user.target ---- + -If you enable the custom systemd service to start at boot (`systemctl enable foo.service`), systemd loads the service when loading the `multi-user.target` at boot time. +If you enable the custom _systemd_ service to start at boot (`systemctl enable foo.service`), _systemd_ loads the service when loading the `multi-user.target` at boot time. . Identify the dependent services and targets. For example, if the custom service requires network connectivity, specify the `network.target` as a dependency: + @@ -36,7 +36,7 @@ Description=My custom service Requires=network.target ---- -. Identify the command used to start the service in the SysVinit script and convert this to the systemd equivalent. For example, the script might contain a `start` function in the following format: +. Identify the command used to start the service in the SysVinit script and convert this to the _systemd_ equivalent. For example, the script might contain a `start` function in the following format: + [source,bash] ---- @@ -91,7 +91,7 @@ ExecStop=/usr/bin/myservice shutdown + Alternatively, you can omit `ExecStop` and use the default behavior, which kills the service. -. Review the SysVinit script and identify any additional parameters or functions. Use systemd parameters to replicate any identified SysVinit functions that might be relevant to your service. +. Review the SysVinit script and identify any additional parameters or functions. Use _systemd_ parameters to replicate any identified SysVinit functions that might be relevant to your service. [discrete] == Related Information diff --git a/modules/ROOT/pages/_partials/proc_creating-new-systemd-services.adoc b/modules/ROOT/pages/_partials/proc_creating-new-systemd-services.adoc index 0fa2fd4..f5b619e 100644 --- a/modules/ROOT/pages/_partials/proc_creating-new-systemd-services.adoc +++ b/modules/ROOT/pages/_partials/proc_creating-new-systemd-services.adoc @@ -16,7 +16,7 @@ This procedure creates a basic configuration file to control the `foo` service. . Create and edit the new configuration file: + ---- -# vi /etc/systemd/system/foo.service +# nano /etc/systemd/system/foo.service ---- . The next few steps describe each section its parameters to add to the file: @@ -24,9 +24,9 @@ This procedure creates a basic configuration file to control the `foo` service. .. The `[Unit]` section provides basic information about the service. The `foo` service uses the following parameters: + `Description`:: - A string describing the unit. systemd displays this description next to the unit name in the user interface. + A string describing the unit. _systemd_ displays this description next to the unit name in the user interface. `Requires`:: - Defines unit to use as a dependency for the service. If you activate the unit, systemd activates the units listed in `Requires` as well. For example, the `foo` service might require network connectivity, which means the `foo` services requires `network.target` as a dependency. + Defines unit to use as a dependency for the service. If you activate the unit, _systemd_ activates the units listed in `Requires` as well. For example, the `foo` service might require network connectivity, which means the `foo` services requires `network.target` as a dependency. + The resulting `[Unit]` section looks like this: + @@ -39,7 +39,7 @@ Requires=network.target .. The `[Service]` section provides instructions on how to control the service. The `foo` service uses the following parameters: + `Type`:: - Defines the type of systemd service. In this example, the `foo` service is a `simple` service, which starts the service without any special consideration. + Defines the type of _systemd_ service. In this example, the `foo` service is a `simple` service, which starts the service without any special consideration. `ExecStart`:: The command to run to start the service. This includes the full path to the command and arguments to modify the service. + @@ -51,10 +51,10 @@ Type=simple ExecStart=/usr/bin/sleep infinity ---- -.. The `[Install]` section provides instructions on how systemd installs the service. The `foo` service uses the following parameters: +.. The `[Install]` section provides instructions on how _systemd_ installs the service. The `foo` service uses the following parameters: + `WantedBy`:: - Defines which service triggers the custom service if enabled with `systemctl enable`. This is mostly used for starting the custom service on boot. In this example, `foo.service` uses `multi-user.target`, which starts `foo.service` when systemd loads `multi-user.target` on boot. + Defines which service triggers the custom service if enabled with `systemctl enable`. This is mostly used for starting the custom service on boot. In this example, `foo.service` uses `multi-user.target`, which starts `foo.service` when _systemd_ loads `multi-user.target` on boot. . The full `foo.service` file contains the following contents: + @@ -73,6 +73,13 @@ WantedBy=multi-user.target + Save the file. +. To make _systemd_ aware of the new service, reload its service files ++ +---- +# systemctl daemon-reload +---- + + . Start the custom `foo` service: + ---- diff --git a/modules/ROOT/pages/_partials/proc_modifying-existing-systemd-services.adoc b/modules/ROOT/pages/_partials/proc_modifying-existing-systemd-services.adoc index 8b17825..5ed3e71 100644 --- a/modules/ROOT/pages/_partials/proc_modifying-existing-systemd-services.adoc +++ b/modules/ROOT/pages/_partials/proc_modifying-existing-systemd-services.adoc @@ -8,7 +8,7 @@ This example shows how to modify an existing service. The files for service modi * You are logged in as a user with administrator-level permissions. -* You have a configured `httpd` server running through systemd. +* You have a configured `httpd` server running through _systemd_. [discrete] == Procedure diff --git a/modules/ROOT/pages/_partials/proc_starting-stopping-and-querying-systemd-services.adoc b/modules/ROOT/pages/_partials/proc_starting-stopping-and-querying-systemd-services.adoc index 7886e62..932a254 100644 --- a/modules/ROOT/pages/_partials/proc_starting-stopping-and-querying-systemd-services.adoc +++ b/modules/ROOT/pages/_partials/proc_starting-stopping-and-querying-systemd-services.adoc @@ -1,7 +1,7 @@ [#starting-stopping-and-querying-systemd-services] = Starting, stopping, and querying systemd services -You can perform various management tasks to control systemd services using the `systemctl` command. The following is a set of example commands to demonstrate how to use `systemctl` to manage systemd services. +You can perform various management tasks to control _systemd_ services using the `systemctl` command. The following is a set of example commands to demonstrate how to use `systemctl` to manage _systemd_ services. [discrete] == Prerequisites @@ -31,19 +31,19 @@ The following commands control the `foo` service: # systemctl restart foo ---- -* Show the status of a service including if it is running or not: +* Show the status of a service including, whether it is running or not: + ---- # systemctl status foo ---- -* Enable a service to be started on bootup: +* Enable a service to be started on boot: + ---- # systemctl enable foo ---- -* Disable a service to not start during bootup: +* Disable a service to not start during boot: + ---- # systemctl disable foo @@ -55,7 +55,7 @@ The following commands control the `foo` service: # systemctl mask foo ---- -* Check if a service is already enabled or not: +* Check if a service is enabled or not: + ---- # systemctl is-enabled foo diff --git a/modules/ROOT/pages/_partials/ref_common-service-parameters.adoc b/modules/ROOT/pages/_partials/ref_common-service-parameters.adoc index 74a7c3f..cce2d3f 100644 --- a/modules/ROOT/pages/_partials/ref_common-service-parameters.adoc +++ b/modules/ROOT/pages/_partials/ref_common-service-parameters.adoc @@ -3,7 +3,7 @@ == Unit Parameters -This section contains parameters you can use in the `[Unit]` section of a service. These parameters are common to other systemd units. +This section contains parameters you can use in the `[Unit]` section of a service. These parameters are common to other _systemd_ units. This list is a summarized version. For a full list of these parameters and their descriptions, run `man systemd.unit`. @@ -14,7 +14,7 @@ Documentation:: A space-separated list of URIs referencing documentation for this service or its configuration. Accepted are only URIs of the following types: `http://`, `https://`, `file:`, `info:`, `man:`. Requires:: - Configures requirement dependencies on other services. If this service gets activated, the units listed here are activated too. If one of the dependent services fails to activate, systemd does not start this service. This option may be specified more than once or you can specify multiple space-separated units. + Configures requirement dependencies on other services. If this service gets activated, the units listed here are activated too. If one of the dependent services fails to activate, _systemd_ does not start this service. This option may be specified more than once or you can specify multiple space-separated units. Wants:: Similar to `Requires`, except failed units do not have any effect on the service. @@ -36,7 +36,7 @@ OnFailure:: == Install Parameters -This section contains parameters you can use in the `[Install]` section of a service. These parameters are common to other systemd units. +This section contains parameters you can use in the `[Install]` section of a service. These parameters are common to other _systemd_ units. This list is a summarized version. For a full list of these parameters and their descriptions, run `man systemd.unit`. @@ -51,7 +51,7 @@ Also:: == Service Parameters -This section contains parameters you can use in the `[Service]` section of a service unit. These parameters are specific only to systemd service units. +This section contains parameters you can use in the `[Service]` section of a service unit. These parameters are specific only to _systemd_ service units. This list is a summarized version. For a full list of these parameters and their descriptions, run `man systemd.unit`. @@ -60,7 +60,7 @@ Type:: + * `simple` - The service starts as the main process. This is the default. * `forking` - The service calls forked processes and run as part of the main daemon. -* `oneshot` - Similar to `simple`, except the process must exit before systemd starts follow-up services. +* `oneshot` - Similar to `simple`, except the process must exit before _systemd_ starts follow-up services. * `dbus` - Similar to `simple`, except the daemon acquires a name of the D-Bus bus. * `notify` - Similar to `simple`, except the daemon sends a notification message using `sd_notify` or an equivalent call after starting up. * `idle` - Similar to `simple`, except the execution of the service is delayed until all active jobs are dispatched. @@ -69,10 +69,10 @@ RemainAfterExit:: A boolean value that specifies whether the service shall be considered active even if all its processes exited. Defaults to no. GuessMainPID:: - A boolean value that specifies whether systemd should guess the main PID of a service if it cannot be determined reliably. This option is ignored unless `Type=forking` is set and `PIDFile` is not set. Defaults to yes. + A boolean value that specifies whether _systemd_ should guess the main PID of a service if it cannot be determined reliably. This option is ignored unless `Type=forking` is set and `PIDFile` is not set. Defaults to yes. PIDFile:: - An absolute filename pointing to the PID file of this daemon. Use of this option is recommended for services where `Type=forking`. systemd reads the PID of the main process of the daemon after start-up of the service. systemd does not write to the file configured here, although it removes the file after the service has shut down. + An absolute filename pointing to the PID file of this daemon. Use of this option is recommended for services where `Type=forking`. _systemd_ reads the PID of the main process of the daemon after start-up of the service. _systemd_ does not write to the file configured here, although it removes the file after the service has shut down. BusName:: A D-Bus bus name to reach this service. This option is mandatory for services where `Type=dbus`. diff --git a/modules/ROOT/pages/_partials/ref_mapping-runlevel-to-targets.adoc b/modules/ROOT/pages/_partials/ref_mapping-runlevel-to-targets.adoc index 7e30b58..994f146 100644 --- a/modules/ROOT/pages/_partials/ref_mapping-runlevel-to-targets.adoc +++ b/modules/ROOT/pages/_partials/ref_mapping-runlevel-to-targets.adoc @@ -1,11 +1,11 @@ [#mapping-runlevels-to-targets] = Mapping runlevels to targets -systemd targets serve a similar purpose to SysVinit runlevels but act a little different. Each target has a name instead of a number and each serves a specific purpose. systemd implements some targets by inheriting all of the services of another target and adding additional services to it. Some systemd targets mimic the common sysvinit runlevels, which means you can switch targets with the familiar `telinit RUNLEVEL` command. The runlevels assigned a specific purpose on vanilla Fedora installs (0, 1, 3, 5, and 6) have a 1:1 mapping with a specific systemd target. +_systemd_ targets serve a similar purpose to SysVinit runlevels but act a little differently. Each target has a name instead of a number and each serves a specific purpose. _systemd_ implements some targets by inheriting all of the services of another target and adding additional services to it. Some _systemd_ targets mimic the common sysvinit runlevels, which means you can switch targets with the familiar `telinit RUNLEVEL` command. The runlevels assigned a specific purpose on vanilla Fedora installs (0, 1, 3, 5, and 6) have a 1:1 mapping with a specific _systemd_ target. -However, this is not the case for user-defined runlevels 2 and 4. To make use of those runlevels, create a new named systemd target such as `/etc/systemd/system/$YOURTARGET` that takes one of the existing runlevels as a base, make a directory `/etc/systemd/system/$YOURTARGET.wants`, and then symlink the additional services to enable into that directory. +However, this is not the case for user-defined runlevels 2 and 4. To make use of those runlevels, create a new named _systemd_ target such as `/etc/systemd/system/$YOURTARGET` that takes one of the existing runlevels as a base, make a directory `/etc/systemd/system/$YOURTARGET.wants`, and then symlink the additional services to enable into that directory. -The following is a mapping of SysVinit runlevels to systemd targets. +The following is a mapping of SysVinit runlevels to _systemd_ targets. [cols="2,5,5",options="header"] .Runlevel to target mapping @@ -28,4 +28,4 @@ has all the services of runlevel 3 plus a graphical login. |6 |runlevel6.target, reboot.target |Reboot |emergency |emergency.target |Emergency shell -|=== \ No newline at end of file +|=== diff --git a/modules/ROOT/pages/_partials/ref_mapping-service-commands.adoc b/modules/ROOT/pages/_partials/ref_mapping-service-commands.adoc index 9226fc8..3ca33d2 100644 --- a/modules/ROOT/pages/_partials/ref_mapping-service-commands.adoc +++ b/modules/ROOT/pages/_partials/ref_mapping-service-commands.adoc @@ -1,9 +1,9 @@ [#mapping-service-commands] = Mapping service commands -The following table demonstrates the systemd equivalent of SysVinit commands. +The following table demonstrates the _systemd_ equivalent of SysVinit commands. -NOTE: All recent versions of systemctl assume the `.service` suffix if left off the service name. For example, `systemctl start frobozz.service` is the same as `systemctl start frobozz`. +NOTE: All recent versions of `systemctl` assume the `.service` suffix if left off the service name. For example, `systemctl start frobozz.service` is the same as `systemctl start frobozz`. [cols=",,",options="header",] |=== @@ -39,4 +39,4 @@ Used to list all the services and other units |`chkconfig frobozz --add`|`systemctl daemon-reload`|Used when you create a new service file or modify any configuration |=== -NOTE: All `/sbin/service` and `/sbin/chkconfig` commands listed in the table continue to work on systemd-based systems and are translated to native equivalents as necessary. The only exception is `chkconfig --list`. +NOTE: All `/sbin/service` and `/sbin/chkconfig` commands listed in the table continue to work on _systemd_-based systems and are translated to native equivalents as necessary. The only exception is `chkconfig --list`. diff --git a/modules/ROOT/pages/understanding-and-administering-systemd.adoc b/modules/ROOT/pages/understanding-and-administering-systemd.adoc index 88fa22d..07f752d 100644 --- a/modules/ROOT/pages/understanding-and-administering-systemd.adoc +++ b/modules/ROOT/pages/understanding-and-administering-systemd.adoc @@ -6,7 +6,7 @@ ifdef::context[:parent-context: {context}] = Understanding and administering systemd :toc: -Learn the basic principles of systemd: how to configure it and use to administer the system. +Learn the basic principles of the _systemd_ init system: how to configure it and use it to administer the system. include::{partialsdir}/con_understanding-systemd.adoc[leveloffset=+1] @@ -28,9 +28,9 @@ include::{partialsdir}/ref_mapping-service-commands.adoc[leveloffset=+1] == Additional resources * http://www.freedesktop.org/wiki/Software/systemd[Project homepage] -* http://0pointer.de/blog/[Lennart Poettering's blog] with lots of information about systemd. Lennart is the primary systemd developer -* http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions[freedesktop.org's systemd FAQ] -* http://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks[freedesktop.org's systemd Tips & Tricks] +* http://0pointer.de/blog/[Lennart Poettering's blog] with lots of information about _systemd_. Lennart is the primary _systemd_ developer +* http://www.freedesktop.org/wiki/Software/systemd/FrequentlyAskedQuestions[freedesktop.org's _systemd_ FAQ] +* http://www.freedesktop.org/wiki/Software/systemd/TipsAndTricks[freedesktop.org's _systemd_ Tips & Tricks] * http://fosdem.org/2011/interview/lennart-poettering.html[Interview with the developer] ifdef::parent-context[:context: {parent-context}]