Changeset 149
- Timestamp:
- Jun 3, 2010, 2:18:15 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nutchez-0.2/src/test/client_install_func.sh
r148 r149 256 256 echo -e "\n= recall_hostname_ip (debug) =" 257 257 258 net_interfaces=$(ifconfig | grep eth | cut -d " " -f1) 259 declare -i i=1 260 echo -e "\nWhich network use for this machine: " 261 262 for net in $net_interfaces 263 do 264 echo "($i) $net" 265 i=i+1 266 done 267 268 read net_choice 269 echo "choice is $net_choice" 270 271 net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice) 272 273 ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1 274 net_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') 276 258 net_interfaces=$(ifconfig | grep ^eth | cut -d " " -f1) 259 net_nu=$(echo $net_interfaces | wc -w) 260 261 # 若只有一個 eth 時 262 if [ "$net_nu" == "1" ]; then 263 264 ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1 265 net_address=$(ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1) 277 266 echo "net_address is $net_address" 267 268 # 若有多個 eth 時 269 else 270 declare -i i=1 271 echo -e "\nSystem have multiple network device, which network use for this machine: " 272 273 for net in $net_interfaces 274 do 275 echo "($i) $net $(ifconfig $net | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)" 276 i=i+1 277 done 278 279 read -p "Plz choice(1/2/3...): " net_choice 280 if [ -z $net_choice ]; then 281 net_choice=1 282 fi 283 284 echo "choice is $net_choice" 285 net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice) 286 ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1 287 net_address=$(ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1) 288 echo "net_address is $net_address" 289 fi 290 278 291 echo "ssh nutchuser@$1 echo $net_address $(hostname) \>\> ~/nutch_nodes" 279 292 su nutchuser -c "ssh nutchuser@$1 echo $net_address $(hostname) \>\> ~/nutch_nodes"
Note: See TracChangeset
for help on using the changeset viewer.