隨著sco unix的日漸衰微,很多廠家不再支持sco,原來那幫執著的sco unix使用者麻煩來了。個人認為沒有必要成為某個廠商的殉葬品。怎麼辦呢?幸好有GNU.
總所周知,redhat有個文件/etc/rc.local,如果我們想定制安裝的軟件隨系統開機啟動的話,只需把啟動程序的命令行追加到這個文件。回到freebsd下,沒有rc.local這個文件。與linux不同,freebsd要自動啟動的程序位於/etc/rc.d目錄(linux是/etc/init.d,還要在運行級別做處理:腳本或鏈接文件)。先看看/etc/rc.d裡面都有啥:
QUOTE:# ll /etc/rc.d
total 362
-r-xr-xr-x 1 root wheel 241 Feb 24 09:41 DAEMON
-r-xr-xr-x 1 root wheel 405 Feb 24 09:41 FILESYSTEMS
-r-xr-xr-x 1 root wheel 404 Feb 24 09:41 LOGIN
-r-xr-xr-x 1 root wheel 339 Feb 24 09:41 NETWORKING
-r-xr-xr-x 1 root wheel 243 Feb 24 09:41 SERVERS
-r-xr-xr-x 1 root wheel 981 Feb 24 09:41 abi
..........................
-r-xr-xr-x 1 root wheel 1803 Feb 24 09:41 ldconfig
-r-xr-xr-x 1 root wheel 535 Feb 24 09:41 local
-r-xr-xr-x 1 root wheel 1147 Feb 24 09:41 localpkg有點好奇,打開文件local看看(耶!是個shell腳本),其內容如下:
QUOTE:# more /etc/rc.d/local
#!/bin/sh
#
# $FreeBSD: src/etc/rc.d/local,v 1.6.14.1 2008/01/28 07:58:31 dougb Exp $
#
# PROVIDE: local
# REQUIRE: DAEMON
# BEFORE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="local"
start_cmd="local_start"
stop_cmd="local_stop"
local_start()
{
echo -n 'Starting local daemons:'
if [ -f /etc/rc.local ]; then
. /etc/rc.local
fi
echo '.'
}
local_stop()
{
echo -n 'Shutting down local daemons:'
if [ -f /etc/rc.shutdown.local ]; then
. /etc/rc.shutdown.local
fi
echo '.'
}
load_rc_config $name
run_rc_command "$1"這個腳本的意圖是:如果存在文件/etc/rc.local,就執行吧,阿門!沒有就算了,一切歸於平靜。既然這樣,我們不妨自己創建文件/etc/rc.local並給予執行權限。/etc/rc.local文件的大致內容為:
QUOTE:#!/bin/sh
/usr/local/apache/bin/apachectl start
/usr/local/mysql/bin/mysqld_safe --user=mysql&重啟一下系統,嘿嘿,apache和mysql都乖乖的起來了。