ubuntu14.04 设置开机自启动脚本

 

添加一个ubuntu的开机启动服务
分为以下几个步骤:
1)新建一个脚本文件 new_services.sh

#!/bin/bash
# command content
exit 0

2)设置权限

sudo chmod +x new_services.sh

3)将脚本放置到启动目录下

sudo mv new_services.sh /etc/init.d/

4)将脚本添加到启动脚本

cd /etc/init.d/
sudo update-rc.d new_serviecs.sh defaults 90

这里90表明一个优先级,越高表示执行的越晚。

移除ubuntu开机脚本

sudo update-rc.d -f new_services.sh remove

 



posted @ 2018-12-12 11:28  anobscureretreat  阅读(681)  评论(0编辑  收藏  举报