mirror of
https://pagure.io/fedora-docs/quick-docs.git
synced 2024-11-24 13:32:42 +00:00
67 lines
1.2 KiB
Text
67 lines
1.2 KiB
Text
[#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.
|
|
|
|
[discrete]
|
|
== Prerequisites
|
|
|
|
You are logged in as a user with administrator-level permissions.
|
|
|
|
[discrete]
|
|
== Procedure
|
|
|
|
The following commands control the `foo` service:
|
|
|
|
* Activate a service immediately:
|
|
+
|
|
----
|
|
# systemctl start foo
|
|
----
|
|
|
|
* Deactivate a service immediately:
|
|
+
|
|
----
|
|
# systemctl stop foo
|
|
----
|
|
|
|
* Restart a service:
|
|
+
|
|
----
|
|
# systemctl restart foo
|
|
----
|
|
|
|
* Show the status of a service including, whether it is running or not:
|
|
+
|
|
----
|
|
# systemctl status foo
|
|
----
|
|
|
|
* Enable a service to be started on boot:
|
|
+
|
|
----
|
|
# systemctl enable foo
|
|
----
|
|
|
|
* Disable a service to not start during boot:
|
|
+
|
|
----
|
|
# systemctl disable foo
|
|
----
|
|
|
|
* Prevent a service from starting dynamically or even manually unless unmasked:
|
|
+
|
|
----
|
|
# systemctl mask foo
|
|
----
|
|
|
|
* Check if a service is enabled or not:
|
|
+
|
|
----
|
|
# systemctl is-enabled foo
|
|
----
|
|
|
|
[discrete]
|
|
== Related Information
|
|
|
|
* Run `man systemctl` for more details.
|