CentOS 的 服务管理,systemctl 的花式命令大全

CentOS 的 服务管理,systemctl 的花式命令大全

一、使用systemctl管理服务

在 centos7中, 可以使用systemctl显示,启动,停止和重启指定服务,操作简单易用。 它整合了chkconfig与service功能于一体。 原服务都安装在 /usr/lib/systemd/system/

1.1 命名格式
systemctl cmd service_name.service   

其中:

* cmd 指命令名称 
* service_name 指的是服务名称  
* .service 也可以省略   
1.2 常用指令

#启动服务

systemctl start firewalld

#停止服务

systemctl stop firewalld

#重启服务

systemctl restart firewalld

#仅仅当服务正在运行时才重启

systemctl try-restart firewalld

#重新加载服务

systemctl reload firewalld

#开机运行服务

systemctl enable firewalld

#取消开机运行服务

systemctl disable firewalld

1.3 状态查询命令

#查询服务运行状态

systemctl status firewalld

#查看服务是否在运行

systemctl is-active firewalld

#查询服务是否开机启动

systemctl is-enabled firewalld

#显示当前已经运行的所有服务

systemctl [list-units] --type service

systemctl [list-units] -at service

#显示所有服务

systemctl [list-units] --type --all

systemctl [list-units] -at service

#显示已加载但出于failed状态的服务

systemctl [list-units] --type service -failed

systemctl [list-units] -t service --failed

引用链接

[1] 羊草–服务管理systemctl

[2] 1lin24–CentOS7的systemctl命令

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值