quick-docs/modules/ROOT/partialsdelete/2delete-proc_starting-stopping-and-querying-systemd-services.adoc

68 lines
1.2 KiB
Text
Raw Normal View History

[#starting-stopping-and-querying-systemd-services]
2018-02-26 16:43:59 +00:00
= 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.
2020-07-26 18:35:01 +00:00
[discrete]
2020-08-05 13:14:35 +00:00
== Prerequisites
2018-01-21 17:04:05 +00:00
You are logged in as a user with administrator-level permissions.
2020-07-26 18:35:01 +00:00
[discrete]
2020-08-05 13:14:35 +00:00
== Procedure
The following commands control the `foo` service:
* Activate a service immediately:
+
----
2018-01-21 17:04:05 +00:00
# systemctl start foo
----
* Deactivate a service immediately:
+
----
2018-01-21 17:04:05 +00:00
# systemctl stop foo
----
* Restart a service:
+
----
2018-01-21 17:04:05 +00:00
# systemctl restart foo
----
* Show the status of a service including, whether it is running or not:
+
----
2018-01-21 17:04:05 +00:00
# systemctl status foo
----
* Enable a service to be started on boot:
+
----
2018-01-21 17:04:05 +00:00
# systemctl enable foo
----
* Disable a service to not start during boot:
+
----
2018-01-21 17:04:05 +00:00
# systemctl disable foo
----
* Prevent a service from starting dynamically or even manually unless unmasked:
+
----
2018-01-21 17:04:05 +00:00
# systemctl mask foo
----
* Check if a service is enabled or not:
+
----
2018-01-21 17:04:05 +00:00
# systemctl is-enabled foo
----
2020-07-26 18:35:01 +00:00
[discrete]
2020-08-05 13:14:35 +00:00
== Related Information
2018-01-21 17:04:05 +00:00
* Run `man systemctl` for more details.