Changeset 159 for nutchez-0.2/src/test
- Timestamp:
- Jun 7, 2010, 5:27:48 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nutchez-0.2/src/test/client_install_func.sh
r157 r159 163 163 # 此步驟若無法連到 master 則跳出 164 164 function scp_master_nutchuser_sshkey(){ 165 echo -e "\n\033[31m= scp_master_nutchuser_sshkey (debug) =\033[0m"166 echo -e "mkdir -p /home/nutchuser/"167 mkdir -p /home/nutchuser/.ssh/168 rm -fr /home/nutchuser/.ssh/*169 170 unset Nutchuser_Passwd2171 172 echo -e "scp nutchuser@$1:~/.ssh /home/nutchuser/"165 echo -e "\n\033[31m= scp_master_nutchuser_sshkey (debug) =\033[0m" 166 echo -e "mkdir -p /home/nutchuser/" 167 mkdir -p /home/nutchuser/.ssh/ 168 rm -fr /home/nutchuser/.ssh/* 169 170 unset Nutchuser_Passwd2 171 172 echo -e "scp nutchuser@$1:~/.ssh /home/nutchuser/" 173 173 expect -c "spawn scp -r -o StrictHostKeyChecking=no nutchuser@$1:~/.ssh /home/nutchuser/ 174 174 expect \"*: \" { send \"$Nutchuser_Passwd\r\" } … … 176 176 expect eof" 177 177 178 if [ -e "/home/nutchuser/.ssh/authorized_keys" ]; then178 if [ -e "/home/nutchuser/.ssh/authorized_keys" ]; then 179 179 echo -e "\nscp correct." 180 180 else 181 182 181 echo -e "\nscp is error,\n(1)plz check nutchuser password in server\n(2)nutchuser's authorized_keys in server\n(3)server's network status" 182 exit 183 183 fi 184 185 echo "chown -R nutchuser:nutchuser /home/nutchuser/.ssh" 186 chown -R nutchuser:nutchuser /home/nutchuser/.ssh 187 184 ssh-add /home/nutchuser/.ssh/id_rsa 185 echo "chown -R nutchuser:nutchuser /home/nutchuser/.ssh" 186 chown -R nutchuser:nutchuser /home/nutchuser/.ssh 188 187 } 189 188 … … 234 233 # 目前僅需做到能無礙的複製遠端的/opt/nutchez/到local的/opt/ 235 234 function scp_packages(){ 236 echo -e "\n\033[31m= scp_packages (debug) =\033[0m" 237 238 mkdir /opt/nutchez 239 mkdir /var/nutchez 240 mkdir /home/nutchuser/nutchez 241 chmod 777 /opt/nutchez 242 #su nutchuser -c "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez /opt/" 243 echo "scp -r nutchuser@$1:/opt/nutchez/NutchezForClientOf_$Master_IP_Address.tar.gz /opt/nutchez/" 244 su nutchuser -c "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez/NutchezForClientOf_$Master_IP_Address.tar.gz /opt/nutchez" 245 246 echo -e "\nchown -R nutchuser:nutchuser /opt/nutchez" 247 chown -R nutchuser:nutchuser /opt/nutchez 248 chown -R nutchuser:nutchuser /var/nutchez 249 chown -R nutchuser:nutchuser /home/nutchuser/nutchez 250 251 chmod 755 /opt/nutchez 235 echo -e "\n\033[31m= scp_packages (debug) =\033[0m" 236 mkdir /opt/nutchez 237 mkdir /var/nutchez 238 mkdir /home/nutchuser/nutchez 239 mkdir /home/nutchuser/nutchez/source 240 chmod 777 /opt/nutchez 241 #su nutchuser -c "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez /opt/" 242 echo "scp -r nutchuser@$1:/opt/nutchez/NutchezForClientOf_$Master_IP_Address.tar.gz /opt/nutchez/" 243 su nutchuser -c "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/home/nutchuser/nutchez/source/NutchezForClientOf_$Master_IP_Address.tar.gz /home/nutchuser/nutchez/source" 244 245 echo -e "\nchown -R nutchuser:nutchuser /opt/nutchez" 246 chown -R nutchuser:nutchuser /opt/nutchez 247 chown -R nutchuser:nutchuser /var/nutchez 248 chown -R nutchuser:nutchuser /home/nutchuser/nutchez 249 chmod 755 /opt/nutchez 252 250 } 253 251 … … 255 253 function install_nutch_package(){ 256 254 echo -e "\n\033[31m= install_nutch_package (debug) =\033[0m" 257 tar -zxvf / opt/nutchez/NutchezForClientOf_$Master_IP_Address.tar.gz -C /258 sed -i .bak'1a '$Master_IP_Address' '$Master_Hostname'' /etc/hosts255 tar -zxvf /home/nutchuser/nutchez/source/NutchezForClientOf_$Master_IP_Address.tar.gz -C /opt/nutchez 256 sed -i '1a '$Master_IP_Address' '$Master_Hostname'' /etc/hosts 259 257 #/opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode 260 258 #/opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker … … 270 268 if [ "$net_nu" == "1" ]; then 271 269 272 ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1270 # ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1 273 271 net_address=$(ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1) 272 net_MacAddr=$(ifconfig $net_interfaces | grep 'HW' | sed 's/^.*HWaddr //g') 274 273 echo "net_address is $net_address" 274 echo "net_MacAddr is $net_MacAddr" 275 275 276 276 # 若有多個 eth 時 … … 289 289 net_choice=1 290 290 fi 291 291 292 292 echo "choice is $net_choice" 293 293 net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice) 294 ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1294 # config $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1 295 295 net_address=$(ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1) 296 net_MacAddr=$(ifconfig $net_interfaces | grep 'HW' | sed 's/^.*HWaddr //g') 296 297 echo "net_address is $net_address" 297 fi 298 299 echo "ssh nutchuser@$1 echo $net_address $(hostname) \>\> ~/nutchez/nutch_nodes" 300 su nutchuser -c "ssh nutchuser@$1 echo $net_address $(hostname) \>\> ~/nutchez/nutch_nodes" 298 echo "net_MacAddr is $net_MacAddr" 299 fi 300 301 echo "ssh nutchuser@$1 echo $net_address $(hostname) $net_MacAddr \>\> ~/nutchez/nutch_nodes" 302 su nutchuser -c "ssh nutchuser@$1 echo $net_address $(hostname) $net_MacAddr \>\> ~/nutchez/nutch_nodes" 301 303 302 304 #su nutchuser -c expect -c "spawn ssh nutchuser@$1
Note: See TracChangeset
for help on using the changeset viewer.