#!/bin/ksh93 typeset -ui idx=0 hosts=( jvm zcs cia kgb birne pflaume quitte pfirsich aprikose uhu eule dommel kauz hermelin marder nerz otter iltis kiefer tanne fichte eibe prinz-c koenig-c baron-c trex grex hippo knechtFB gw p3x-242 p3x-333 p3x-336 sonne sonne2 sonne3 sonne4 sunray-w2003 sunray-solaris hubble2 hubble asteroid next merkur venus erde mars jupiter saturn uranus neptun pluto mond erdmond io ganymed callisto europa titan mimas enceladus tethys dione rhea hyperion iapetus phoebe oberon titania umbriel ariel miranda triton nereid faracvs crab-nebulae andromeda cats-eye cone-nebulae horsehead m27 omega orion reflection plejades sombrero southern-ring ngc3370 m8 boomerang helix-nebula tadpole m51 wixp ) # out is the timeout HIDX="IDX" HTIMEOUT=" TIMEOUT" HATTEMPTS="ATTEMPTS" HTRYAGAIN="TRYAGAIN" HGETENT="GETENT" HHOST=" HOST" FORMAT="%2d: %${#HTIMEOUT}d %${#HATTEMPTS}d %${#HTRYAGAIN}d %${#HGETENT}s %s\n" print "$HIDX $HTIMEOUT $HATTEMPTS $HTRYAGAIN $HGETENT TARGET" function updateResolvConf { TIMEOUT=$1 ATTEMPTS=$2 svccfg -s dns/client "setprop config/options = astring: \"timeout:$1 attempts:$2\"" svccfg -s dns/client:default refresh svcadm restart dns/client sleep 1 } function updateNSS { TRYAGAIN=$1 svccfg -s name-service/switch "setprop config/host = \"files dns [TRYAGAIN=$1]\"" svccfg -s name-service/switch:default refresh svcadm restart name-service/switch sleep 1 } updateResolvConf 1 1 updateNSS 1 printf "$FORMAT" 0 $TIMEOUT $ATTEMPTS $TRYAGAIN "-" "initialized" for ((i=0; i <= 5; i++)); do for ((j=0; j <= 3; j++)); do updateResolvConf $i $j # retry for ((k=0; k <= 3; k++, idx++)); do updateNSS $k #grep ^hosts: /etc/nsswitch.conf #grep ^options /etc/resolv.conf T=( $( /usr/bin/time getent hosts ${hosts[$idx]} 2>&1 ) ) #(( idx++ )) #U=( $( /usr/bin/time host ${hosts[$idx]} 2>&1 ) ) #for ((x=0; x < ${#U[@]}; x++)); do # print "U[$x]=${U[$x]}" #done printf "$FORMAT" $idx $TIMEOUT $ATTEMPTS $TRYAGAIN "${T[1]}" "${hosts[$idx]}" (( (idx+1) >= ${#hosts[@]} )) && idx=0 done done done