centos7使用systemd管理开机自启动服务,不提倡rc.local。
假设现在有2个服务,分别为:
- my111;
- my222;
希望在开机时自动启动my222服务,但是my222启动需要my111也启动;
假设上面的2个服务在启动时,会分别调用2个脚本:
- my111; ==>/tmp/run1
- my222; ==>/tmp/run2
下面讲述如何完成上面的工作:
![](https://images2015.cnblogs.com/blog/731047/201603/731047-20160317214345287-1140741424.png)
![](https://images2015.cnblogs.com/blog/731047/201603/731047-20160317214346865-1684333109.png)
systemctl enable my222.service
![](https://images2015.cnblogs.com/blog/731047/201603/731047-20160317214347568-2070145792.png)
reboot
![](https://images2015.cnblogs.com/blog/731047/201603/731047-20160317214347959-1890220723.png)
转载请标明出处:http://www.cnblogs.com/ssslinppp/