systemctl 管理服务的启动、重启、停止、重载、查看状态命令

systemd初始化进程


前言

初始化进程作为Linux系统的第一个进程,它的工作是完成Linux系统里相关的初始化工作,为用户提供合适的工作环境。并且从rehat7版本开始系统已经替换掉以前的System V init,正式使用systemd 初始化进程服务。当然systemd 初始化进程服务采取了并发启动机制,因此开机速度得到了不小的提升。


本文示例:通过systemd初始化进程来管理网络服务

一、systemctl 管理服务的启动、重启、停止、重载、查看状态命令。

1.启动网络服务:systemctl start 服务名称;
查看状态命令:systemctl status 服务名称;
systemctl 管理服务的启动、重启、停止、重载、查看状态命令
2.重启网络服务:systemctl restart 服务名称;
systemctl 管理服务的启动、重启、停止、重载、查看状态命令
3.停止网络服务:systemctl stop 服务名称;
systemctl 管理服务的启动、重启、停止、重载、查看状态命令
4.重新加载配置文件(不终止服务): systemctl reload 服务名称;
systemctl 管理服务的启动、重启、停止、重载、查看状态命令

二、systemctl 设置服务开机启动或不启动、查看各级别下服务启动状态命令。

1.开机自动启动:systemctl enable 服务名称;
查看特定服务是否为开机自动启动:systemctl is-enabled 服务名称;
systemctl 管理服务的启动、重启、停止、重载、查看状态命令
2.开机不自动启动:systemctl disable 服务名称;
systemctl 管理服务的启动、重启、停止、重载、查看状态命令