CentOS7 服务检查命令

列出所有服务

systemctl list-unit-files

列出运行中的服务

systemctl list-units

列出所有失败的服务

systemctl --failed

检查单个服务是否启用

systemctl is-enabled mysqld.service

查看单个服务的状态

systemctl status firewalld.service

启动、重启、停止、重载某个服务

systemctl start httpd.service
systemctl restart httpd.service
systemctl stop httpd.service
systemctl reload httpd.service
systemctl status httpd.service

激活/禁止自动重启

systemctl enable httpd.service
systemctl disable httpd.service

使用Systemctl控制并管理挂载点

systemctl list-unit-files --type=socket
systemctl start cups.socket
systemctl restart cups.socket
systemctl stop cups.socket
systemctl reload cups.socket
systemctl status cups.socket
systemctl is-active cups.socket
systemctl enable cups.socket
systemctl disable cups.socket
systemctl mask cups.socket

使用Systemctl管理服务的CPU利用率

systemctl show -p CPUShares httpd.service
systemctl set-property httpd.service CPUShares=2000
systemctl show -p CPUShares httpd.service
systemctl show httpd

启动防火墙

systemctl start firewalld.service

停止防火墙

systemctl stop firewalld.service

查看firewalld防火墙状态

firewall-cmd --state

禁止防火墙开机启动

systemctl disable firewalld.service

列出正在运行的服务状态

systemctl

启动一个服务

systemctl start postfix.service

关闭一个服务

systemctl stop postfix.service

重启一个服务

systemctl restart postfix.service

显示一个服务的状态

systemctl status postfix.service

在开机时启用一个服务

systemctl enable postfix.service

在开机时禁用一个服务

systemctl disable postfix.service

查看服务是否开机启动

systemctl is-enabled postfix.service

查看已启动的服务列表

systemctl list-unit-files|grep enabled
原文地址:https://www.cnblogs.com/ZeroSunny/p/12667080.html