centos7使用systemd管理开机自启动服务,不提倡rc.local。
假设现在有2个服务,分别为:
- my111;
- my222;
希望在开机时自动启动
my222服务,但是
my222启动需要
my111也启动;
假设上面的2
个服务在启动时,会分别调用2个脚本:
- my111; ==>/tmp/run1
- my222; ==>/tmp/run2
下面讲述如何完成上面的工作:


systemctl enable my222.service

reboot
