debian上使用rc.local
kevin.Zhu 发布于:2013-1-16 0:57 分类:Debian 有 14 人浏览,获得评论 0 条
习惯了FreeBSD和RedHat上使用/etc/rc.local 定制服务的自动启动,最近用Debian还真有些不习惯。以下是我搜集到的资料:在debian上创建rc.local文件。
创建文件:
代码:
sudo touch /etc/init.d/rc.local
设置可执行:
代码:
sudo chmod +x /etc/init.d/rc.local
用update-rc.d设置启动级别:
sudo update-rc.d rc.local start 20 2 3 4 5 . stop 20 0 1 6 .
为了编辑方便,创建一个链接:
代码:
sudo ln -s /etc/init.d/rc.local /etc/rc.local
cat /etc/rc.local
# start apache
/home/apache/bin/apachectl start
重启一下,没有问题。
后记:Debian 下没有 rc.local ,不过有一个替代品,就是 /etc/init.d/bootmisc.sh 文件(可以将/etc/rc.local 链接过去)
大家有什么需要启动后运行的,尽管往里面塞
类似的:也是使用update-rc.d 将相应服务设置成启动就可以了。