Changeset 147 for nutchez-0.2/src/test


Ignore:
Timestamp:
Jun 3, 2010, 11:38:08 AM (14 years ago)
Author:
rock
Message:

新增 recall_hostname_ip() 用來回傳 hostname和ip 到server的 ~/nutch_nodes

Location:
nutchez-0.2/src/test
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nutchez-0.2/src/test/client_install

    r146 r147  
    8888# 安裝及啟動
    8989install_nutch_package
     90read
    9091
     92# 回覆 Hostname 和 IP 給 Master Server
     93recall_hostname_ip $Master_IP_Address
  • nutchez-0.2/src/test/client_install_func.sh

    r145 r147  
    247247
    248248
    249 function install_nutch_package () {
     249function install_nutch_package(){
    250250  tar -zxvf /opt/nutchez/NutchezForClientOf_$Master_IP_Address.tar.gz -C /
    251251  /opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode
    252252  /opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker
    253253}
     254
     255function recall_hostname_ip(){
     256echo -e "\n= recall_hostname_ip (debug) ="
     257
     258net_interfaces=$(ifconfig | grep eth | cut -d " " -f1)
     259declare -i i=1
     260echo -e "\nWhich network use for this machine: "
     261
     262for net in $net_interfaces
     263    do
     264        echo "($i) $net"
     265        i=i+1
     266    done
     267
     268read net_choice
     269echo "choice is $net_choice"
     270
     271net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice)
     272
     273ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1
     274net_address=$(ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)
     275#net_address=$(ifconfig eth"${net_choice}" | grep "inet addr:" | sed 's/^.*inet addr://g' | sed 's/Bcast.*$//g')
     276echo "net_address is $net_address"
     277
     278su nutchuser -c "ssh nutchuser@$1 echo $net_address $(hostname) \>\> ~/nutch_nodes"
     279#su nutchuser -c expect -c "spawn ssh nutchuser@$1
     280#set timeout 1
     281#expect \"*\"
     282#send \"echo $net_address $(hostname) >> /home/nutchuser/nutch_nodes\r\"
     283#expect \"*\"
     284#send \"exit\""
     285}
Note: See TracChangeset for help on using the changeset viewer.