歡迎您光臨本站 註冊首頁

請問該怎樣配置才能用service named start命令

←手機掃碼閱讀     火星人 @ 2014-03-04 , reply:0

請問該怎樣配置才能用service named start命令

環境:
OS:Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
software:bind9.5.0-P2

named -g測試正常
但我用service named start命令提示named: unrecognized service 請問該怎樣配置才能用service named start來啟動呢?
《解決方案》

named: unrecognized service
shell在當前的PATH下找不到service 這個命令

echo $PATH 看看輸出是否帶有 /sbin 這個路徑,如果沒有,則自己加上去
$ PATH=$PATH:/sbin
export $PATH
再用service 就可以了
《解決方案》

named: unrecognized service
shell在當前的PATH下找不到service 這個命令

echo $PATH 看看輸出是否帶有 /sbin 這個路徑,如果沒有,則自己加上去
$ PATH=$PATH:/sbin
export $PATH
再用service 就可以了
《解決方案》

建立啟動腳本(我的bind裝在了/usr/local/named裡面了,大家根據自己的named路徑改動一下即可):
# vi /etc/init.d/named
======================= named.sh =======================
#!/bin/bash
# named        a network name service.
# chkconfig: 545 35 75
# description: a name server
#
if [ `id -u` -ne 0 ]
then
echo "ERROR:For bind to port 53,must run as root."
exit 1
fi
case "$1" in

start)
if [ -x /usr/local/named/sbin/named ]; then
/usr/local/named/sbin/named -u named -c /usr/local/named/etc/named.conf && echo . && echo 'BIND9 server started.'
fi
;;
stop)
kill `cat /var/run/named/named.pid` && echo . && echo 'BIND9 server stopped.'
;;
restart)
echo .
echo "Restart BIND9 server"
$0 stop
sleep 10
$0 start
;;
*)
echo "$0 start | stop | restart"
;;
esac
======================= named.sh =======================

# chmod 755 /etc/init.d/named
# chkconfig –add named
# chkconfig named on

[ 本帖最後由 llzqq 於 2008-8-8 07:58 編輯 ]
《解決方案》

Thanks各位的熱心回答,我設置好$PATH之後,再建立啟動腳本
# service named start
啟動 named:                                               [失敗]

查看日誌如下,不知道那時出了錯,

Aug 11 14:30:59 wwww named: starting BIND 9.5.0-P2 -u named
Aug 11 14:30:59 wwww named: found 1 CPU, using 1 worker thread
Aug 11 14:30:59 wwww named: loading configuration from '/etc/named.conf'
Aug 11 14:30:59 wwww named: /etc/named.conf:12: change directory to '/var/named' failed: permission denied
Aug 11 14:30:59 wwww named: /etc/named.conf:12: parsing failed
Aug 11 14:30:59 wwww named: loading configuration: permission denied
Aug 11 14:30:59 wwww named: exiting (due to fatal error)
Aug 11 14:30:59 wwww named: named 啟動 failed

[火星人 ] 請問該怎樣配置才能用service named start命令已經有1029次圍觀

http://coctec.com/docs/service/show-post-28380.html