cike0415 发表于 2018-8-25 06:30:18

shell脚本实现DNS的自动安装与配置

  #!/bin/bash
  read -p   "Please enter your zone:"ZONE
  read -p"Please enter your IPNET,:" NET
  YOURIP=`ifconfig eth0| grep "inet addr" | sed 's/^.*addr://g' | sed 's/Bcast.*$//g'`
  LAST=`echo $YOURIP | awk 'BEGIN {FS="."}{print $4}'`
  FANXIANG=`echo $NET | awk 'BEGIN {FS="."}{print $3"."$2"."$1}'`
  rpm -q bind &>/dev/null && rpm -qcaching-nameserver &>/dev/null
  let BOOL=`echo $?`
  if [ $BOOL -eq 1 ];then
  yum -y install bind
  yum -y install caching-nameserver
  fi
  rpm -q bind &>/dev/null && rpm -qcaching-nameserver &>/dev/null
  let BOOL2=`echo $?`
  if [ $BOOL2 -eq 1 ]; then
  echo "Sorry,bind is not install!"
  exit
  fi
  #********************************************
  echo "make named.conf......"
  cat>>/etc/named.conf>/var/named/$ZONE.zone>/var/named/$NET.zone
页: [1]
查看完整版本: shell脚本实现DNS的自动安装与配置