分类: LINUX
2008-07-08 09:01:05
建立启动脚本:
# 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
# chown root:root /etc/init.d/named
# chkconfig –add named