linux 初始化进程
legacy 体系:
SysVinit
:
初始化脚本位于 /etc/init.d/
,初始化脚本需要支持 start
, stop
, status
等命令
使用 service
命令运行初始化脚本SysVinit
只启动一次,在之后不跟踪单个服务
新体系:
systemd
用于代替 SysVinit
,在初始化结束时, systemd
仍然作为守护进程运行。
使用 systemctl
与 systemd
交互,运行服务。
sudo systemctl enable [service]
开机启动服务sudo systemctl disable [service]
不开机启动服务sudo systemctl start [service]
sudo systemctl stop [service]
sudo systemctl restart [service]