centos7的服务管理systemctl
Linux Systemctl是一个系统管理守护进程、工具和库的集合,用于取代System V、service和chkconfig命令,初始进程主要负责控制systemd系统和服务管理器。通过Systemctl –help可以看到该命令主要分为:查询或发送控制命令给systemd服务,管理单元服务的命令,服务文件的相关命令,任务、环境、快照相关命令,systemd服务的配置重载,系统开机关机相关的命令。 1.启动、重启、停止、重载服务以及检查服务(如 httpd.service)状态 systemctl start httpd.service systemctl restart httpd.service systemctl stop httpd.service systemctl reload httpd.service systemctl status httpd.service 注意:当我们使用systemctl的start,restart,stop和reload命令时,终端不会输出任何内容,只有status命令可以打印输出。 2. 如何激活服务并在开机时启用或禁用服务(即系统启动时自动启动mysql.service服务) systemctl is-active mysql.service systemctl enable mysql.service systemctl