Systemctl usage in RHEL 7 (replacing service and chkconfig), rhelsystemctl
1. systemctl is the main tool in RHEL 7 service management tools. It integrates the functions of previous services and chkconfig. You can use it to enable or disable services permanently or only in the current session.
Systemctl can list the running service statuses,
Systemd-cgls lists running processes in a tree. It recursively displays control group content.
2. How do I start/disable, enable/disable a service?
Start a service:systemctl start postfix.service
Close a service:systemctl stop postfix.service
Restart a service:systemctl restart postfix.service
Displays the status of a service:systemctl status postfix.service
Enable a service at startup:systemctl enable postfix.service
Disable a service at startup:systemctl disable postfix.service
Check whether the service is started:systemctl is-enabled postfix.service
View the list of started services:systemctl list-unit-files|grep enabled
View the list of failed services:systemctl --failed
PS: Use the command systemctl is-enabled postfix. the value obtained by the service can be enable, disable, or static. static here means that the [Install] region is not defined in the corresponding Unit file, so the service cannot be configured as a start-up service.
(Enable the service is in the current "runlevel" configuration file directory/etc/systemd/system/multi-user.target.wants, create a soft link corresponding to the service configuration file in/usr/lib/systemd/system. To disable a service, delete the soft link. To add a service, add a soft connection.
-----------------------
(End)
Copyright Disclaimer: This article is an original article by the blogger and cannot be reproduced without the permission of the blogger.