自学内容网 自学内容网

systemctl centos7 LTS

systemctl centos7 LTS

sudo systemctl daemon-reload

sudo systemctl start nginx

sudo systemctl enable nginx

查询出系统的服务: systemctl list-units --all , 可以用grep快速筛选要找的服务。

服务单元,你可以理解为系统服务和原来的init.d下面的服务一样,只是比它更加丰富。每一个服务都是以.service进行标识的,如下图:

systemctl list-unit-files – type =service
我们看看一个服务包含哪些内容:

systemctl cat sshd.service

#启动一个服务
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
#查看启动失败的服务列表
systemctl --failed
#重新加载service文件
systemctl daemon-reload

原文地址:https://blog.csdn.net/wowocpp/article/details/142453935

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!