centos7 系统管理systemd学习记录

在centos7之前,系统服务是service,chkconfig等命令来管理的。到了centos7,统一使用systemctl来管理系统服务

其实就是把chkconfig和service结合在一起了,chkconfig主要用来控制开机自启动,service则是用来管理服务的开启关闭的

service mysqld start    systemctl start mysqld  启动服务

service mysqld stop    systemctl stop mysqld  关闭服务 

service mysqld reload   systemctl reload mysqld  重新加载配置文件

service mysqld restart    systemctl restart mysqld  重启服务

service mysqld status    systemctl status mysqld  查看服务状态

其实就是把service换成systemctl,并且把命令提前了,很好理解

chkconfig mysqld on  systemctl enable mysqld  开机自动启动

chkconfig mysqld off  systemctl disable mysqld  开机不自动启动

chkconfig mysqld    systemctl is-enabled mysqld  查看特定服务是否开机启动

chkconfig --list     systemctl list-unit-files --type=service  查看各个级别下服务的启动和禁用情况

其实到了centos7之后service和chkconfig命令都还可以使用,但是推荐使用systemctl,使用之前的命令的时候系统会提示你改用systemctl对应的命令

原文地址:https://www.cnblogs.com/lgh344902118/p/7168445.html