'쉘프로그래밍'에 해당되는 글 1건

  1. 2009.08.04 솔라리스 DNS설정 스크립트 (6)

솔라리스 DNS설정 스크립트

Linux & Solaris 2009.08.04 05:16 posted by JP™


네이버 솔라리스스쿨 에서 퍼 온것으로 기억 하고 있으며
솔라리스 10의 DNS설정을 쉽게 해 주는 스크립트 입니다.


#!/bin/ksh
# Make by chojaekoo
# E-mail : cjk10004@hanmail.net , chojaekoo@lge.com
# date   : 2001.12.13
# Program Name : Client setup the DNS
NSSWITCH_TABLE_IPV4=
IMSI_FILE=/tmp/DNS_IMSI

IPv4_setup()
 {
 NSSWITCH_TABLE_IPV4=`grep ^hosts /etc/nsswitch.conf`

 # hosts 항목이 없으면 강제로 등록 합니다.

 echo $NSSWITCH_TABLE_IPV4  | grep -i hosts >/dev/null
 if [ $? != 0 ]
    then
       echo "hosts: files dns ">> /etc/nsswitch.conf
      return
 fi

 DNS_LINE_NUMBER=` grep -n ^hosts /etc/nsswitch.conf|cut -d ':' -f1`
 DNS_LINE_NUMBER_1=$(($DNS_LINE_NUMBER-1))
 echo $NSSWITCH_TABLE_IPV4 | grep -i dns >/dev/null
 if [ $? != 0 ]
    then
        head -$DNS_LINE_NUMBER_1 /etc/nsswitch.conf> $IMSI_FILE
        echo "$NSSWITCH_TABLE_IPV4 dns" >>$IMSI_FILE
        FULL_NUMBER=`wc -l /etc/nsswitch.conf |awk '{print $1} `
        DNS_LINE_NUMBER_1=$(($FULL_NUMBER-$DNS_LINE_NUMBER))
        tail -$DNS_LINE_NUMBER_1 /etc/nsswitch.conf >>$IMSI_FILE
        mv $IMSI_FILE /etc/nsswitch.conf
    else
        echo "IPV4는 이미 등록이 되어 있습니다."
fi

 }

IPv6_setup()
 {
NSSWITCH_TABLE_IPV6=`grep ^ipnodes /etc/nsswitch.conf`

 # ipnodes 항목이 없으면 강제로 등록 합니다.

 echo $NSSWITCH_TABLE_IPV6  | grep -i ipnodes >/dev/null
 if [ $? != 0 ]
    then
       echo "ipnodes: files dns ">> /etc/nsswitch.conf
      return
 fi

 DNS_LINE_NUMBER=` grep -n ^ipnodes /etc/nsswitch.conf|cut -d ':' -f1`
 DNS_LINE_NUMBER_1=$(($DNS_LINE_NUMBER-1))
 echo $NSSWITCH_TABLE_IPV6 | grep -i dns >/dev/null
 if [ $? != 0 ]
    then
        head -$DNS_LINE_NUMBER_1 /etc/nsswitch.conf> $IMSI_FILE
        echo "$NSSWITCH_TABLE_IPV6 dns" >>$IMSI_FILE
        FULL_NUMBER=`wc -l /etc/nsswitch.conf |awk '{print $1} `
        DNS_LINE_NUMBER_1=$(($FULL_NUMBER-$DNS_LINE_NUMBER))
        tail -$DNS_LINE_NUMBER_1 /etc/nsswitch.conf >>$IMSI_FILE
        mv $IMSI_FILE /etc/nsswitch.conf
    else
        echo "IPv6는 이미 등록이 되어 있습니다."
fi
 }

Resolv_setup()
{
 RESOLV_FILE=/etc/resolv.conf
 RESOLV_FILE_IMSI=/tmp/RESOLV.IMSI
 echo "현재 이 서버의 domain 명은 무엇인가요? (생략 가능) = \c"
 read RESOLV_DOMAIN
 echo "검색할 domain 은 무엇인 가요? ( 생략 가능 ) = \c"
 read RESOLV_SEARCH
 > $RESOLV_FILE_IMSI
 while :
 do
 echo "DNS 서버의 IP Address 를 입력 하세요 (중지시 'S' 입력)=\c"
 read RESOLV_IPADDRESS
 if [ -z $RESOLV_IPADDRESS ]
   then
      continue
 fi
 if [ $RESOLV_IPADDRESS = 's' -o $RESOLV_IPADDRESS = 'S' ]
   then
      break
 fi
   echo "$RESOLV_IPADDRESS">>$RESOLV_FILE_IMSI
 done
 echo "\n\n\n /etc/resolv.conf 파일에 다음과 같이 적용 합니다."
 echo "----------------------------------------------"
 echo "domainname $RESOLV_DOMAIN   #현재 이 서버의 domain명 "
 echo "search $RESOLV_SEARCH   #검색할 domain 명"
 for i in `cat $RESOLV_FILE_IMSI`
 do
 echo "nameserver $i    #DNS 서버의 IP Address"
 done
 echo "----------------------------------------------\n"
 echo " 위의 내용 대로 적용 할 까요? (y/n) = \c"
 read YESNO
 [ -z $YESNO ] && YESNO='n'
 if [ $YESNO = 'y'  -o  $YESNO = 'Y' ]
    then
       echo "domain $RESOLV_DOMAIN  #현재 이 서버의 domain명" >$RESOLV_FILE
       echo "search $RESOLV_SEARCH  #검색할 domain 명" >>$RESOLV_FILE
       for i in `cat $RESOLV_FILE_IMSI`
       do
  echo "nameserver $i    #DNS 서버의 IP Address">>$RESOLV_FILE
       done
     else
        echo "종료 합니다......"
        exit 0
 fi


}
echo "\n\n\n"
echo "-----------------------------------------------"
echo "|                                             |"
echo "|  DNS Client Setup 프로 그램입니다.          |"
echo "|  ===============================            |"
echo "|                                             |"
echo "| 이프로그램의 저작자는 조재구 입니다.        |"
echo "| http://cafe.daum.net/osschoo                |"
echo "| E-mail: cjk10004@hanmail.net                |"
echo "|                                             |"
echo "| Client 에 설정 하는 두개의 파일 을 설정 함  |"
echo "| /etc/resolv.conf 와  /etc/nsswitch.conf     |"
echo "-----------------------------------------------\n\n"
echo "\n\n\n /etc/resolv.conf 파일에 설정 값을 물어 봅니다.\n"
Resolv_setup

echo "\n\n다음은 /etc/nsswitch.conf 파일의 내용을 수정 합니다."
echo "다음중 해당 되는 내용을 선택 해 주세요..\n\n"

echo " 1) IPv4 에 해당 되는 내용 수정 (hosts : dns)  "
echo " 2) IPv6 에 해당 되는 내용 수정 (ipnodes : dns)  "
echo " 3) IPv4 또는 IPv6 에 해당 되는 내용 수정"
echo " 어떤 부분을 설정 하시겠습니까?(1-3 번 외에는 중지 합니다.) = \c "
read qu
case "$qu" in
     '1') IPv4_setup
          ;;
     '2') IPv6_setup
          ;;
     '3') IPv4_setup
          IPv6_setup
          ;;
     '*') exit
          ;;
esac


  1. Commented by moncler online at 2013.01.04 17:51

    Le PDG de la société suisse Monodor, http://www.moncleroutletespain.com/ moncler, Eric Favre, http://www.moncleroutletespain.com/ moncler outlet, premier patron de Nespresso et inventeur des capsules éponymes, http://www.moncleroutletespain.com/ moncler chaquetas, va lancer ses propres dosettes de thé, un marché en plein essor sur lequel Nestlé s'est engouffré en mai dernier, http://www.moncleroutletespain.com/ moncler españa, a-t-on appris jeudi. Eric Favre, inventeur en 1976 du concept de capsules à café Nespresso, http://www.moncleroutletespain.com/ http://www.moncleroutletespain.com/, qui ont fait la fortune de Nestlé, va présenter mercredi à Pékin son nouveau concept de thé en dosettes baptisé "Tpresso", selon un communiqué. Economie L'AMF accorde à Hermès sa dispense d'OPA Economie Boeing a livré 462 avions en 2010, http://www.moncleroutletespain.com/ moncler online, moins que l'an dernierRelated articles:


    http://songsama.tistory.com/70 http://songsama.tistory.com/70

    http://lalawin.com/1247 http://lalawin.com/1247

  2. Commented by TORY BURCH ROBINSON SMALL DOUBLE ZIP TOTE PINK at 2013.10.25 18:18

    기립[标签:标题],BCBG One Shoulder Vertical Halter Evening dress Pink
    This is a must-have baby product as it won’t be too long before that happens and she will be going everywhere with you. Very importantly,BCBG BRIANA COCKTAIL DRESS WHITE, lucyyanglili2013 enjoy your baby- she won’t be so little for too long.
    相关的主题文章:


    JEFFREY CAMPBELL SIMPLE SANDAL NUDE

    BCBGMAXAZRIA GARNET SLEEVELESS 법메

  3. Commented by Nike Air Force 1 Star at 2013.10.29 17:16

    료히aber für diejenigen von uns, die grundstücke in gemeinschaftsgärten neigen , diese überlegungen auf einem ganz anderen ton nehmen - und mehr subversive - als die der besitzenden gardeners.i lebe mit meiner familie in einem 200condo turm im herzen von chicago. wir haben keinen balkon, und tomaten sind strikt von den gepflegten innenhof verboten . um unsere lieblings- blumen und gemüse wachsen ,, wi할마

  4. Commented by Frauen Moncler Daunenjacke at 2013.12.05 02:20

    예니frankfurt am main - nach dm ausverkauf der vergangenen tagen haben anleger in den usa im sp zehn handel wieder zugegriffen ? . der dow jones schloss bei hohen ums ? tzen prozent eitern bei z ? hler , nachdem er zum handelsschluss in deutschland , prozent im plus gelegen hatte . die nasdaq , zur schlussglocke in frankfurt noch minimal im minus ,UGG Ultra Tall Boots, kletterte in den letzten beiden 버어

  5. Commented by www.rundeutschlandschuhe.com at 2014.02.08 07:35

    관있in der aktuellen blick auf aktien bestellt größten marktkapitalisierung , russell komponente treehouse foods inc nyse: apol nach der online- investor , : ths wurde als mit einem größeren marktkapitalisierung als die kleinere ende des sampp ,Ralph Lauren Schuhe, zum beispiel apollo , inc. nasd identifiziert . klicken sie hier, um die top- sampp komponenten bestellt durchschnittlichen analystenbewer는메

  6. Commented by Nike Air Max Turbulence 12 at 2014.02.08 07:35

    선가chimera investment corporation nyse: cim ist als top dividendpaying finanzwerte genannt worden , nach dividenden channel,Ralph Lauren damen, der seinen jüngsten dividendrank bericht veröffentlicht. der bericht stellte fest , dass unter s von finanzunternehmen ,Belstaff online shop, angezeigt cim sowohl attraktiv als bewertungskennzahlen und hohe ertragskennzahlen . zum beispiel die letzten cim pre다가