源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

浅谈RHEL 7中systemctl 的用法(替代service和chkconfig)

  • 时间:2021-02-24 22:11 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:浅谈RHEL 7中systemctl 的用法(替代service和chkconfig)
[b]1、systemctl是RHEL 7 的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。可以使用它永久性或只在当前会话中启用/禁用服务。[/b] systemctl可以列出正在运行的服务状态,如图: [img]http://files.jb51.net/file_images/article/201611/20161130095430.jpg[/img] systemd-cgls以树形列出正在运行的进程,它可以递归显示控制组内容。如图: [img]http://files.jb51.net/file_images/article/201611/20161130095447.jpg[/img] [b]2、如何启动/关闭、启用/禁用服务?[/b] 启动一个服务: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 [b]PS:[/b]使用命令 systemctl is-enabled postfix.service 得到的值可以是enable、disable或static,这里的 static 它是指对应的 Unit 文件中没有定义[Install]区域,因此无法配置为开机启动服务。 说明:启用服务就是在当前“runlevel”的配置文件目录/etc/systemd/system/multi-user.target.wants/里,建立/usr/lib/systemd/system里面对应服务配置文件的软链接;禁用服务就是删除此软链接,添加服务就是添加软连接。如图: [img]http://files.jb51.net/file_images/article/201611/201611300959173.jpg[/img] 以上这篇浅谈RHEL 7中systemctl 的用法(替代service和chkconfig)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持编程素材网。
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部