※ 引述《[email protected] (尋找我的最愛)》之銘言:
> 請問一下各位...
> FreeBSD 4.5R把 rc.local拿掉了...
> 我再灌Maple3.02時完成了...
> 想請問一下要怎麼設定他自動啟動呢??...thx...
預設下,一樣在/etc下寫rc.local就可以執行了
--
∕ 發信站: 來源:
◥◤ 元智資管.螺絲起子 h35.s99.ts32.hinet.net
│ (bbs.mis.yzu.edu.tw)
┴
> -------------------------------------------------------------------------- <
發信人: [email protected] (奈~), 看板: FreeBSD
標 題: Re: 請教一下...FreeBSD 4.5R自動啟動
發信站: Catpit_BBS (Mon Jun 3 03:50:18 2002)
轉信站: Ptt!news.ntu!news.mcu!news.cs.nthu!news.cis.nctu!Catpit
※ 引述《[email protected] (While you...)》之銘言:
> 關於開機執行,有一個問題一直困擾我
> /etc/rc
> if [ -r /etc/defaults/rc.conf ]; then
> . /etc/defaults/rc.conf
> source_rc_confs
############### 注意一下這行
> elif [ -r /etc/rc.conf ]; then
> . /etc/rc.conf
> fi
> defaults/rc.conf是預設值
> 而我們所做的修改通常是加在/etc/rc.conf
> 此段程式碼指若defaults/rc.conf存在
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 則就不會執行/etc/rc.conf
^^^^^^^^^^^^^^^^^^^^^^^^
是這樣講沒錯...
> 那我寫/etc/rc.conf是不是就沒意義了呢?
不過 ....
你看一下 /etc/defaults/rc.conf :
前面有一行: rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
後面有一段:
if [ -z "${source_rc_confs_defined}" ]; then
source_rc_confs_defined=yes
source_rc_confs () {
local i sourced_files
for i in ${rc_conf_files}; do
case ${sourced_files} in
*:$i:*)
;;
*)
sourced_files="${sourced_files}:$i:"
if [ -r $i ]; then
. $i
fi
;;
esac
done
}
fi
基本上執行完後面這段後, 會產生 source_rc_confs() 這個 function.
/etc/default/rc.conf 執行完畢後,
接著回到 /etc/rc 後的下一個指令,也就是 ############## (我剛剛標起來的地方),
便會去執行 source_rc_confs() 這個 function.
這個 function 會把之前定義的 rc_conf_files 這個變數裡面的檔案名稱
拿來 source. (也就是會去執行 /etc/rc.conf 以及 /etc/rc.conf.local 就是了)
所以謎題就解開了... :)