似乎centos7之后(我的是7.3)把service命令给干掉了,有文章 说统一使用systemctl命令了。
下面记录下systemctl的使用:
- 列出所有可用单元
systemctl list-unit-files
- 列出所有运行中单元
-
systemctl list-units
检查某个单元是否启用
systemctl is-enabled MysqLd.service
查看某个服务(单元)的状态
systemctl status MysqLd.service
- 启动、关闭、重启服务
# systemctl start httpd.service # systemctl restart httpd.service # systemctl stop httpd.service # systemctl reload httpd.service
# systemctl enable httpd.service # systemctl disable httpd.service
- *杀死服务
-
#systemctl kill httpd