标题:CentOS 7 上systemctl 的用法,systemctl 命令完全指南,以及反查到它属于哪个rpm包方便卸载用chkconfig替换回来。 出处:向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除 时间:Thu, 23 Jun 2016 09:56:39 +0000 作者:jackxiang 地址:http://jackxiang.com/post/8758/ 内容: 背景:对chkconfig还没用熟悉又来了一个新的,systemctl里的启动参位位置。 The default configuration file can be found at: /etc/sysconfig/memcached When started, Memcached will start on port 11211 by default per the default configuration file: PORT=”11211″ USER=”memcached” MAXCONN=”1024″ CACHESIZE=”64″ OPTIONS=”” To change the port (PORT), the user Memcached runs as (USER), the maximum number of allowed connections to Memcached (MAXCONN), or the cache size in megabytes (CACHESIZE), simply edit the configuration file. 来自:https://www.liquidweb.com/kb/how-to-install-memcached-on-fedora-20/ systemctl 命令完全指南:https://linux.cn/article-5926-1.html 将kong.service添加进入sytstemctl里面: install -p -D -m 0755 %{SOURCE4} %{buildroot}/usr/lib/systemd/system/kong.service systemctl enable kong.service 将kong.service的sytstemctl里面停止: systemctl stop kong.service 如何屏蔽(让它不能启动)或显示服务: systemctl unmask kong.service rm -rf /usr/lib/systemd/system/kong.service 使用systemctl命令杀死服务: systemctl kill kong systemctl status kong rpm -qf /usr/bin/systemctl systemd-219-19.el7_2.11.x86_64 yum remove systemd-219-19.el7_2.11 -y 错误:尝试移除受保护的 "systemd",为嘛不让卸载?? [root@iZ25z0ugwgtZ init.d]# systemctl disable mysqld.service mysqld.service is not a native service, redirecting to /sbin/chkconfig. Executing /sbin/chkconfig mysqld off [root@iZ25z0ugwgtZ init.d]# /sbin/chkconfig mysqld off [root@iZ25z0ugwgtZ init.d]# /sbin/chkconfig jenkins off 我们对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 Generated by Jackxiang's Bo-blog 2.1.1 Release