博客
关于我
Linux学习总结(27)——CentOS7及以上系统的systemctl命令使用介绍
阅读量:797 次
发布时间:2023-02-03

本文共 638 字,大约阅读时间需要 2 分钟。

要管理systemd服务,可以按照以下步骤进行操作:

查看正在运行的服务

要查看正在运行的服务,使用以下命令:

systemctl list-unit-files

这将显示所有正在运行的服务。

启动服务

要启动特定服务,使用以下命令:

systemctl start foo.service

替换foo.service为实际服务名称。

关闭服务

要关闭特定服务,使用以下命令:

systemctl stop foo.service

替换foo.service为实际服务名称。

重启服务

要重启特定服务,使用以下命令:

systemctl restart foo.service

替换foo.service为实际服务名称。

查看服务状态

要查看特定服务的状态,使用以下命令:

systemctl status foo.service

替换foo.service为实际服务名称。

设置服务开机启动

要设置服务在开机时自动启动,使用以下命令:

systemctl enable foo.service

替换foo.service为实际服务名称。

取消开机启动

要取消服务在开机时自动启动,使用以下命令:

systemctl disable foo.service

替换foo.service为实际服务名称。

查看服务开机启动状态

要查看服务是否在开机时启动,使用以下命令:

systemctl is-enabled foo.service

替换foo.service为实际服务名称。

转载地址:http://kezfk.baihongyu.com/

你可能感兴趣的文章
Linux学习总结(41)——运维不仅仅是Linux
查看>>
Linux学习总结(42)——Linux之Bash脚本入门学习
查看>>
Linux学习总结(43)——企业运维最常用的150个Linux命令
查看>>
Linux学习总结(44)——Linux操作系统基础知识
查看>>
Linux学习总结(45)——Linux服务器出现卡慢的基本解决方法
查看>>
Linux学习总结(46)——Centos7.4设置开机自动登陆及网卡自动启用
查看>>
Linux学习总结(47)——Linux系统用户以及用户组的管理
查看>>
Linux学习总结(48)——Linux防火墙iptables与firewalld学习总结
查看>>
Linux学习总结(49)——应当竭力避免在系统中运行的 Linux 命令
查看>>
Linux学习总结(4)——Centos6.5使用yum安装mysql——快速上手必备
查看>>
Linux学习总结(50)——grep查看打印匹配的下几行或前后几行使用总结
查看>>
Linux学习总结(51)——25个Linux服务器安全小贴士
查看>>
Linux学习总结(52)——主流 Linux 发行版性能对比
查看>>
Linux学习总结(53)——后台启动nohup >/dev/null 2>&1 使用总结
查看>>
Linux学习总结(54)——Red Hat Enterprise Linux与CentOS的区别
查看>>
Linux学习总结(55)——Linux 运维常用脚本
查看>>
Linux学习总结(56)——如何处理阿里云服务器上入侵的kdevtmpfsi 挖矿病毒
查看>>
Linux学习总结(57)——生产环境用户权限管理规范
查看>>
Linux学习总结(58)——生产环境运维故障处理指南
查看>>
Linux学习总结(5)——CentOS常用的目录文件操作命令
查看>>