新聞中心
Unix系統(tǒng)使用比較廣泛的便是linux系統(tǒng),而基于Linux內(nèi)核下也有很多衍生的其他的系統(tǒng),其中就有Debian、ubuntu這類的系統(tǒng),在Linux系統(tǒng)下平時(shí)使用習(xí)慣的開(kāi)機(jī)啟動(dòng)/etc/rc.local或/etc/rc.d/rc.local就沒(méi)有了,那在Debian、Ubuntu下需要開(kāi)啟啟動(dòng)時(shí)就需要使用update-rc.d用來(lái)定義開(kāi)機(jī)啟動(dòng)的命令 ,舉一個(gè)簡(jiǎn)單的例子在Debian、Ubuntu開(kāi)機(jī)啟動(dòng)iptables:

在Debian、Ubuntu中iptables并沒(méi)有被做成類似Linux下的服務(wù),所以需要啟動(dòng)時(shí)就用到update-rc.d,通過(guò)man手冊(cè)得知update-rc.d需要在/etc/init.d目錄下有啟動(dòng)文件,所以在Debian、Ubuntu下開(kāi)啟iptables就可以通過(guò)以下方式:
root@localhost:/usr/local/scripts# vim iptables.sh
#!/bin/bash
/sbin/iptables-restore < /usr/local/scripts/iptables
root@localhost:/usr/local/scripts# ln -sv /usr/local/scripts/iptables.sh /etc/init.d/iptables
root@localhost:/usr/local/scripts# update-rc.d iptables defaults
這樣就在開(kāi)機(jī)啟動(dòng)時(shí)就會(huì)把自行定義寫好的iptables文件導(dǎo)入啟用,而在update-rc.d定義一些系統(tǒng)中的服務(wù)開(kāi)機(jī)自啟也很簡(jiǎn)單,如開(kāi)啟自啟ssh服務(wù):
root@localhost:/usr/local/scripts# update-rc.d ssh enable
這樣就啟用了開(kāi)機(jī)自啟ssh服務(wù),類似于Linux系統(tǒng)下的chkconfig、systemctl,當(dāng)然更多的使用方法可以參看man幫助手冊(cè)。
網(wǎng)站名稱:Debian、Ubuntu系統(tǒng)中開(kāi)機(jī)啟動(dòng)設(shè)置
標(biāo)題URL:http://m.fisionsoft.com.cn/article/ccdphhc.html


咨詢
建站咨詢
