Linux系统开机过程:BIOS-->Boot Loader-->加载内核-->内核初始化-->启动初始化进程。
CentOS 7/8采用systemd初始化进程服务。
命令 | 作用 |
systemctl start 服务名称 | 启动服务 |
systemctl restart 服务名称 | 重启服务 |
systemctl stop 服务名称 | 停止服务 |
systemctl reload 服务名称 | 重新加载配置文件(不终止服务) |
systemctl status 服务名称 | 查看服务状态 |
systemctl enable 服务名称 | 开机自动启动 |
systemctl disable 服务名称 | 开机不自动启动 |
systemctl is-enabled 服务名称 | 查看特定服务是否为开机自启动 |
systemctl list-unit-files --type=服务名称 | 查看各个级别下服务的启动与禁用情况 |
例如:
1、重启httpd服务
systemctl restart httpd
2、检测sshd服务是否开机自启动
systemctl is-enabled sshd