欢迎光临
我们一直在努力

使用linux的systemctl命令管理系统服务

不懂使用linux的systemctl命令管理系统服务?其实想解决这个问题也不难,下面让小编带着大家一起学习怎么去解决,希望大家阅读完这篇文章后大所收获。

Centos7之后从init完全换成了systemd的启动方式,systemd 启动服务的机制主要是通过 systemctl 的这个系统服务管理指令来处理。systemctl在用法上也囊括 service / chkconfig / setup / init 的大部分功能。

语法格式:systemctl [参数] [服务]

常用参数:

-start 启动服务
-stop 停止服务
-restart 重启服务
-enable 使某服务开机自启
-disable 关闭某服务开机自启
-status 查看服务状态
-list -units –type=service 列举所有已启动服务

参考实例

启动httpd服务:

[root@linuxcool ~]# systemctl start httpd.service 

停止httpd服务:

[root@linuxcool ~]# systemctl stop httpd.service 

重启httpd服务:

[root@linuxcool ~]# systemctl restart httpd.service 

查看httpd服务状态:

[root@linuxcool ~]# systemctl status httpd.service  

使httpd开机自启:

[root@linuxcool ~]# systemctl enable httpd.service  

取消httpd开机自启:

[root@linuxcool ~]# systemctl disable httpd.service   

列举所有已启动服务(unit单元) :

[root@linuxcool ~]# systemctl list-units --type=service

感谢你能够认真阅读完这篇文章,希望小编分享使用linux的systemctl命令管理系统服务内容对大家有帮助,同时也希望大家多多支持云搜网,关注云搜网行业资讯频道,遇到问题就找云搜网,详细的解决方法等着你来学习!

赞(0)
【声明】:本博客不参与任何交易,也非中介,仅记录个人感兴趣的主机测评结果和优惠活动,内容均不作直接、间接、法定、约定的保证。访问本博客请务必遵守有关互联网的相关法律、规定与规则。一旦您访问本博客,即表示您已经知晓并接受了此声明通告。