quick-docs/en-US/modules/proc_starting-stopping-and-querying-systemd-services.adoc

65 lines
1.2 KiB
Text
Raw Normal View History

[#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.
.Prerequisites
2018-01-21 17:04:05 +00:00
You are logged in as a user with administrator-level permissions.
.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 if it is running or not:
+
----
2018-01-21 17:04:05 +00:00
# systemctl status foo
----
* Enable a service to be started on bootup:
+
----
2018-01-21 17:04:05 +00:00
# systemctl enable foo
----
* Disable a service to not start during bootup:
+
----
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 already enabled or not:
+
----
2018-01-21 17:04:05 +00:00
# systemctl is-enabled foo
----
.Related Information
2018-01-21 17:04:05 +00:00
* Run `man systemctl` for more details.