linux named.run,linux,bind,named开机启动脚本

#!/bin/sh

# named a network name service.

# chkconfig: - 65 37

# description: a name server

#if [ `id -u` -ne 0 ]

# #then

# #echo "ERROR:For bind to port 53,must run as root."

# #exit 1

#fi

# Source function library.

. /etc/rc.d/init.d/functions

. /etc/sysconfig/network

prog="named"

exec="/usr/local/bind9/sbin/named"

config="/usr/local/bind9/etc/name.conf"

pid="/usr/local/bind9/var/run/named.pid"

case "$1" in

start)

named_run_status=0

RESPONSE=$(/usr/local/bind9/sbin/rndc status 2>&1)

echo "$RESPONSE" | grep -q "connect failed" && named_run_status=1

if [ $named_run_status -eq 1 ]; then

$exec -4 -c $config -f &

action "$prog is running" /bin/true

else

action "$prog already running" /bin/false

fi

;;

stop)

if [ -e $pid ]; then

kill `cat $pid` && action "$prog already stoping" /bin/true

else

action 'named already stoping' /bin/false

fi

;;

restart)

$0 stop

sleep 1

$0 start

;;

reload)

/usr/local/bind9/sbin/rndc reload

;;

status)

/usr/local/bind9/sbin/rndc status

;;

*)

echo "$0 start | stop | restart |reload |status"

;;

esac

bind 防火墙通过规则

-A INPUT -p tcp -m tcp --dport 53 -j ACCEPT

-A INPUT -p udp -m udp --dport 53 -j ACCEPT

分享到:

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值