越简单越好!

CentOS 7.0 systemctl使用说明

发表于 2015-05-21 13:30 | 1335次阅读 0次点赞   CentOs

centos 7.0 引入了很多心得特性,感觉比较大的是sytemctl 命令的使用。

systemd使用方法:
systemd的服务管理程序
systemctl是最主要的工具。它融合 service 和chkconfig的功能于一体。你可以使用它永久性或只在当前会话中启用/禁用服务。
下面命令用于列出正在运行的服务或其他: systemctl

更多详细信息请参考手册页(man systemctl)。systemd-cgls以树形列出正在运行的进程。它可以递归显示给定控制组内容。详情请参阅systemd-cgls手册页。

如何启动/关闭、启用/禁用服务?
运行一个服务:
systemctl start network.service 关闭网络服务:
systemctl stop network.service 重启网络服务:
systemctl restart network.service
显示一个服务(无论运行与否)的状态: systemctl status network.service
在开机时启用一个服务: systemctl enable network.service
在开机时禁用一个服务: systemctl disable network.service

查看服务开机是否启动:systemctl is-enabled network.service;echo $? 或者是chkconfig
使用systemctl命令,要记住start,stop,restart,status,enable,disable,is-enabled。就可以很好的使用!

systemd查看开机自启动的程序
相当于chkconfig --list
ls /etc/systemd/system/multi-user.target.wants/
返回顶部 ^