最近玩Linux发现了systemctl这个命令,不管是Ubuntu还是Centos还是其他的发行版都有这个命令,其实这个命令早就存在了,相当于将service和chkconfig命令整合到一起了,实际上systemctl不仅仅包含service和chkconfig的功能,还有其他的功能,本文仅讨论systemctl与service,chkconfig的关系
systemctl与service对比
| daemon命令 | systemctl命令 | 说明 |
|---|---|---|
| service [服务] start | systemctl start [unit type] | 启动服务 |
| service [服务] stop | systemctl stop [unit type] | 停止服务 |
| service [服务] restart | systemctl restart [unit type] | 重启服务 |
例:
#启动Apache
systemctl start httpd.service
#停止Apache
systemctl stop httpd.service
#重启Apache
systemctl restart httpd.service
#查看Apache状态
systemctl status httpd.service
systemctl与chkconfig对比
| daemon命令 | systemctl命令 | 说明 |
|---|---|---|
| chkconfig [服务] on | systemctl enable [unit type] | 设置服务开机启动 |
| chkconfig [服务] off | systemctl disable [unit type] | 设备服务禁止开机启动 |
例:
#设置Apache开机启动
systemctl enable httpd.service
#禁止Apache开机启动
systemctl disable httpd.service
作者在使用Linux时发现systemctl命令,该命令存在于多种发行版中,它将service和chkconfig命令整合,且功能不止于此。文章主要讨论systemctl与service、chkconfig的关系,并给出对比示例。
1819

被折叠的 条评论
为什么被折叠?



