CentOS 7 上systemctl 的用法,systemctl 命令完全指南,以及反查到它属于哪个rpm包方便卸载用chkconfig替换回来。

jackxiang 2016-6-23 09:56 | |
背景:对chkconfig还没用熟悉又来了一个新的,systemctl里的启动参位位置。

来自:https://www.liquidweb.com/kb/how-to-install-memcached-on-fedora-20/

systemctl 命令完全指南:https://linux.cn/article-5926-1.html


rpm -qf  /usr/bin/systemctl
systemd-219-19.el7_2.11.x86_64

yum remove systemd-219-19.el7_2.11  -y
错误:尝试移除受保护的 "systemd",为嘛不让卸载??



我们对service和chkconfig两个命令都不陌生,systemctl 是管制服务的主要工具, 它整合了chkconfig 与 service功能于一体。

systemctl is-enabled iptables.service
systemctl is-enabled servicename.service #查询服务是否开机启动
systemctl enable vsftpd.service #开机运行服务
systemctl disable vsftpd.service #取消开机运行
systemctl start vsftpd.service #启动服务
systemctl stop vsftpd.service #停止服务
systemctl restart vsftpd.service #重启服务
systemctl reload vsftpd.service #重新加载服务配置文件
systemctl status vsftpd.service #查询服务运行状态
systemctl --failed #显示启动失败的服务

注:*代表某个服务的名字,如http的服务名为httpd


例如在CentOS 7 上安装http

[root@CentOS7 ~]# yum -y install httpd
启动服务(等同于service httpd start)
systemctl start httpd.service
停止服务(等同于service httpd stop)
systemctl stop httpd.service
重启服务(等同于service httpd restart)
systemctl restart httpd.service
查看服务是否运行(等同于service httpd status)
systemctl status httpd.service
开机自启动服务(等同于chkconfig httpd on)
systemctl enable httpd.service
开机时禁用服务(等同于chkconfig httpd on)
systemctl disable httpd.service
查看服务是否开机启动 (等同于chkconfig --list)

来自:http://www.linuxidc.com/Linux/2014-11/109236.htm

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/8758/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2018-7-19 18:11
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]