In the systemctl Centos is the command to set the system services, namely service, before it blends service and chkconfig functions in one.
You can use it permanently or only enable / disable service in the current session.
CentOS /etc/rc.d/rc.local 7 is not authorized to perform, the system recommends creating systemd service to start the service.
Check the list of services status:
systemctl list-units --type=service
systemctl list-unit-files lists all installed services and state (the man can read, the content is simple, clear):
systemctl can list the services that are running the state, as the basic :( not well read, the contents of complex, comprehensive)
systemd-cgls a tree list the running processes, which can recursively display content control group. Figure:
2, how to enable / disable, enable / disable services?
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 boot: systemctl enable postfix.service
disable a service at boot:systemctl disable postfix.service
See if service startup: systemctl is-enabled postfix.service
Check the list of services have been started: systemctl list-unit-files | grep enabled
View a list of services failed to start: systemctl --failed
PS:使用命令 systemctl is-enabled postfix.service 得到的值可以是enable、disable或static,这里的 static 它是指对应的 Unit 文件中没有定义[Install]区域,因此无法配置为开机启动服务。
Description: The service is enabled in the current "runlevel" profile directory /etc/systemd/system/multi-user.target.wants, the establishment of / usr / lib / systemd / system inside the corresponding soft link service profile;
Disabling this service is to remove soft links, add the service is to add a soft link.
Open a service file, look at its contents: