Changeset 213 for nutchez-0.2/src/test/install_func.sh
- Timestamp:
- Jun 21, 2010, 9:49:42 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
nutchez-0.2/src/test/install_func.sh
r206 r213 1 1 #!/bin/bash 2 source $Work_Path/ install_lang2 source $Work_Path/lang_link 3 3 ####### garbage here ############# 4 4 function mainFunction ( ) … … 65 65 debug_info "check_root" 66 66 if [ $USER != "root" ]; then 67 show_info "$ check_root_1"67 show_info "$MI_check_root_1" 68 68 exit 69 69 fi 70 show_info "$ check_root_2"70 show_info "$MI_check_root_2" 71 71 } 72 72 73 73 function check_systemInfo(){ 74 debug_info "$ check_sys_1"75 show_info "$ check_sys_2"74 debug_info "$MI_check_sys_1" 75 show_info "$MI_check_sys_2" 76 76 Linux_Distribution=$(lsb_release -a 2> /dev/null | grep "Distributor ID:" | awk '{print $3}') 77 77 Linux_Version=$(lsb_release -a 2> /dev/null | grep "Release" | awk '{print $2}') … … 81 81 function install_packages(){ 82 82 # deb 系列系統 83 debug_info "$ install_pack_1"84 debug_info "$ install_pack_2"83 debug_info "$MI_install_pack_1" 84 debug_info "$MI_install_pack_2" 85 85 if [ "$Linux_Distribution" == "Ubuntu" ] || [ "$Linux_Distribution" == "Debian" ] ;then 86 echo -e "\n$ install_pack_if_1\n"86 echo -e "\n$MI_install_pack_if_1\n" 87 87 aptitude install -y expect ssh dialog 88 88 # rpm 系列系統 89 89 elif [ "$Linux_Distribution" == "Fedora" ] || [ "$Linux_Distribution" == "CentOS" ] ;then 90 show_info "$ install_pack_if_2"91 else 92 show_info "$ install_pack_if_2"90 show_info "$MI_install_pack_if_2" 91 else 92 show_info "$MI_install_pack_if_2" 93 93 fi 94 94 } 95 95 96 96 function check_nez_installed(){ 97 debug_info "$ check_nez_1"97 debug_info "$MI_check_nez_1" 98 98 if [ -d "/opt/nutchez" ]; then 99 show_info "$ check_nez_2"99 show_info "$MI_check_nez_2" 100 100 exit 101 101 else 102 show_info "$ check_nez_3"102 show_info "$MI_check_nez_3" 103 103 fi 104 104 } 105 105 106 106 function check_sunJava(){ 107 debug_info "$ check_sunJava_1"108 debug_info "$ check_sunJava_2"107 debug_info "$MI_check_sunJava_1" 108 debug_info "$MI_check_sunJava_2" 109 109 110 110 javaPath="/usr" … … 118 118 119 119 if [ "$JAVA_org" == "" ]; then 120 show_info "$ check_sunJava_if_1"121 show_info "$ check_sunJava_if_2"122 show_info "$ check_sunJava_if_3"123 read -p "$ check_sunJava_if_4" choice120 show_info "$MI_check_sunJava_if_1" 121 show_info "$MI_check_sunJava_if_2" 122 show_info "$MI_check_sunJava_if_3" 123 read -p "$MI_check_sunJava_if_4" choice 124 124 case $choice in 125 125 "1") 126 show_info "$ check_sunJava_if_5"126 show_info "$MI_check_sunJava_if_5" 127 127 exit 128 128 ;; 129 129 "2") 130 read -p "$ check_sunJava_if_6" javaPath130 read -p "$MI_check_sunJava_if_6" javaPath 131 131 ;; 132 132 "*") … … 141 141 142 142 if [ "$JAVA_org" == "" ]; then 143 show_info "$ check_sunJava_if_7"143 show_info "$MI_check_sunJava_if_7" 144 144 exit 145 145 fi … … 149 149 large16=$(echo "$JAVA_version >= 1.6" | bc) 150 150 if [ "${large16}" == 0 ]; then 151 show_info "$ check_sunJava_if_8"151 show_info "$MI_check_sunJava_if_8" 152 152 exit 153 153 fi 154 154 155 show_info "$ check_sunJava_if_9"156 else 157 show_info "$ check_sunJava_if_10"155 show_info "$MI_check_sunJava_if_9" 156 else 157 show_info "$MI_check_sunJava_if_10" 158 158 exit 159 159 fi … … 165 165 # 檢查是否有安裝openssh, openssh-server 166 166 function check_ssh(){ 167 debug_info "$ check_ssh_1"167 debug_info "$MI_check_ssh_1" 168 168 if [ -e /usr/bin/ssh ]; then 169 show_info "$ check_ssh_2"170 else 171 show_info "$ check_ssh_3"169 show_info "$MI_check_ssh_2" 170 else 171 show_info "$MI_check_ssh_3" 172 172 exit 173 173 fi 174 174 175 175 if [ -e /usr/sbin/sshd ]; then 176 show_info "$ check_ssh_4"177 else 178 show_info "$ check_ssh_5"176 show_info "$MI_check_ssh_4" 177 else 178 show_info "$MI_check_ssh_5" 179 179 exit 180 180 fi … … 184 184 # 檢查是否有安裝dialog 185 185 function check_dialog(){ 186 debug_info "$ check_dialog_1"186 debug_info "$MI_check_dialog_1" 187 187 if [ -e /usr/bin/dialog ]; then 188 show_info "$ check_dialog_2"189 else 190 show_info "$ check_dialog_3"188 show_info "$MI_check_dialog_2" 189 else 190 show_info "$MI_check_dialog_3" 191 191 exit 192 192 fi … … 210 210 211 211 function set_nutchuser_passwd () { 212 read -sp "$ set_nutchuser_passwd_echo_1" Nutchuser_Passwd212 read -sp "$MI_set_nutchuser_passwd_echo_1" Nutchuser_Passwd 213 213 # read -sp "Please enter nutchuser's password : " Nutchuser_Passwd 214 214 echo -e "\n" 215 read -sp "$ set_nutchuser_passwd_echo_2" Nutchuser_Passwd2215 read -sp "$MI_set_nutchuser_passwd_echo_2" Nutchuser_Passwd2 216 216 # read -sp "Please enter nutchuser's password again: " Nutchuser_Passwd2 217 217 echo -e "\n" … … 273 273 else 274 274 declare -i i=1 275 show_info "$ select_eth_echo_1"275 show_info "$MI_select_eth_echo_1" 276 276 # show_info "\nSystem have multiple network device, which network use for this machine: " 277 277 … … 281 281 i=i+1 282 282 done 283 read -p "$ select_eth_echo_2" net_choice283 read -p "$MI_select_eth_echo_2" net_choice 284 284 # read -p "Please choice(1/2/3...): " net_choice 285 285 if [ -z $net_choice ]; then … … 287 287 fi 288 288 289 show_info "$ select_eth_echo_3 $net_choice"289 show_info "$MI_select_eth_echo_3 $net_choice" 290 290 # show_info "Your choice is $net_choice" 291 291 net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice) … … 294 294 net_MacAddr=$(ifconfig $net_interface | grep 'HW' | sed 's/^.*HWaddr //g') 295 295 296 show_info "$ select_eth_echo_4 $net_address"296 show_info "$MI_select_eth_echo_4 $net_address" 297 297 # show_info "net_address is $net_address" 298 show_info "$ select_eth_echo_5 $net_MacAddr"298 show_info "$MI_select_eth_echo_5 $net_MacAddr" 299 299 # show_info "net_MacAddr is $net_MacAddr" 300 300 fi … … 303 303 304 304 function show_master_info () { 305 show_info "$ show_master_info_echo_1 $MasterIP_Address"306 show_info "$ show_master_info_echo_2 $net_MacAddr"305 show_info "$MI_show_master_info_echo_1 $MasterIP_Address" 306 show_info "$MI_show_master_info_echo_2 $net_MacAddr" 307 307 308 308 # show_info "The Master IP Address is $MasterIP_Address" … … 311 311 312 312 function make_ssh_key () { 313 debug_info "$ make_ssh_key_echo_1"313 debug_info "$MI_make_ssh_key_echo_1" 314 314 # debug_info "Make ssh key(begin...)" 315 315 su nutchuser -c 'ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ""' 316 316 su nutchuser -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys" 317 317 su nutchuser -c "ssh-add /home/nutchuser/.ssh/id_rsa" 318 debug_info "$ make_ssh_key_echo_2"318 debug_info "$MI_make_ssh_key_echo_2" 319 319 # debug_info "Make ssh key(done!)" 320 320 } … … 322 322 323 323 function set_haoop-site () { 324 debug_info "$ set_haoop_site_echo_1"324 debug_info "$MI_set_haoop_site_echo_1" 325 325 # debug_info "set hadoop-site.xml(begin...)" 326 326 cd $Nutch_HOME/conf/ … … 341 341 </configuration> 342 342 EOF 343 debug_info "$ set_haoop_site_echo_2"343 debug_info "$MI_set_haoop_site_echo_2" 344 344 # debug_info "set hadoop-site.xml(done!)" 345 345 } … … 347 347 # 修改nutch-site.xml中-http.agent.url, http.agent.email 348 348 function set_nutch-site () { 349 debug_info "$ set_nutch_site_echo_1"349 debug_info "$MI_set_nutch_site_echo_1" 350 350 # debug_info "set nutch-site.xml(begin...)" 351 351 Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.url' | sed 's/:.*//g'` 352 debug_info "$ set_nutch_site_echo_2"352 debug_info "$MI_set_nutch_site_echo_2" 353 353 # debug_info "debug...http.agent.url line number = $Line_NO..." 354 354 sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml 355 debug_info "$ set_nutch_site_echo_3"355 debug_info "$MI_set_nutch_site_echo_3" 356 356 # debug_info "debug...edit http.agent.url delete line $((Line_NO+1))..." 357 357 sed -i ''$Line_NO'a <value>'$MasterIP_Address'</value>' $Nutch_HOME/conf/nutch-site.xml 358 debug_info "$ set_nutch_site_echo_4"358 debug_info "$MI_set_nutch_site_echo_4" 359 359 # debug_info "debug...edit http.agent.url done..." 360 360 361 361 Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.email' | sed 's/:.*//g'` 362 debug_info "$ set_nutch_site_echo_5"362 debug_info "$MI_set_nutch_site_echo_5" 363 363 # debug_info "debug...http.agent.email line number = $Line_NO..." 364 364 365 365 sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml 366 debug_info "$ set_nutch_site_echo_6"366 debug_info "$MI_set_nutch_site_echo_6" 367 367 # debug_info "debug...edit http.agent.email delete line $((Line_NO+1))..." 368 368 sed -i ''$Line_NO'a <value>'$Admin_email'</value>' $Nutch_HOME/conf/nutch-site.xml 369 debug_info "$ set_nutch_site_echo_7"369 debug_info "$MI_set_nutch_site_echo_7" 370 370 # debug_info "debug...edit http.agent.email done..." 371 debug_info "$ set_nutch_site_echo_8"371 debug_info "$MI_set_nutch_site_echo_8" 372 372 # debug_info "set nutch-site.xml(done!)" 373 373 } 374 374 375 375 function format_HDFS () { 376 debug_info "$ format_HDFS_echo_1"376 debug_info "$MI_format_HDFS_echo_1" 377 377 su nutchuser -c "$Nutch_HOME/bin/hadoop namenode -format" 378 debug_info "$ format_HDFS_echo_2"378 debug_info "$MI_format_HDFS_echo_2" 379 379 } 380 380 381 381 function start_up_NutchEZ (){ 382 debug_info "$ start_up_NutchEZ_echo_1"382 debug_info "$MI_start_up_NutchEZ_echo_1" 383 383 # debug_info "start up NutchEZ..." 384 384 su nutchuser -c "$Nutch_HOME/bin/start-all.sh" … … 387 387 388 388 function set_hosts () { 389 debug_info "$set_hosts_echo_1" 389 debug_info "$MI_set_hosts_echo_1" 390 cp /etc/hosts /home/nutchuser/nutchez/system/hosts.bak 390 391 Line_NO=`cat /etc/hosts | grep -n $(hostname) | sed 's/:.*//g'` 391 392 content=$(cat /etc/hosts | awk 'NR=='$Line_NO'{printf "# " ; print}' ) … … 395 396 396 397 function Install_Nutch () { 397 debug_info "$ install_Nutch_echo_1 $MasterIP_Address "398 debug_info "$MI_install_Nutch_echo_1 $MasterIP_Address " 398 399 # debug_info "MasterIP_Address=$MasterIP_Address" 399 debug_info "$ install_Nutch_echo_2 $(hostname)"400 debug_info "$MI_install_Nutch_echo_2 $(hostname)" 400 401 # debug_info "Master_Hostname=$(hostname)" 401 402 su nutchuser -c "echo $net_address $(hostname) $net_MacAddr \>\> ~/nutchez/system/nutch_nodes" … … 409 410 cd $Start_PATH 410 411 Line_NO=`cat client_install | grep -n '# Master IP here' | sed 's/:.*//g'` 411 debug_info "$ client_PassMasterIPAddr_echo_1"412 debug_info "$MI_client_PassMasterIPAddr_echo_1" 412 413 # debug_info "debug...Master IP here line number = $Line_NO..." 413 414 sed -i ''$((Line_NO+1))'d' client_install 414 debug_info "$ client_PassMasterIPAddr_echo_2"415 debug_info "$MI_client_PassMasterIPAddr_echo_2" 415 416 # debug_info "debug...edit Master IP at line $((Line_NO+1))..." 416 417 sed -i ''$Line_NO'a Master_IP_Address='$MasterIP_Address'' client_install 417 debug_info "$ client_PassMasterIPAddr_echo_3"418 debug_info "$MI_client_PassMasterIPAddr_echo_3" 418 419 # debug_info "edit client_install done..." 419 420 } … … 423 424 cd $Start_PATH 424 425 Line_NO=`cat client_install | grep -n '# Master Hostname here' | sed 's/:.*//g'` 425 debug_info "$ client_PassMaster_Hostname_echo_1"426 debug_info "$MI_client_PassMaster_Hostname_echo_1" 426 427 # debug_info "debug...Master hostname here line number = $Line_NO..." 427 428 sed -i ''$((Line_NO+1))'d' client_install 428 debug_info "$ client_PassMaster_Hostname_echo_2"429 debug_info "$MI_client_PassMaster_Hostname_echo_2" 429 430 # debug_info "debug...edit Master Hostname at line $((Line_NO+1))..." 430 431 sed -i ''$Line_NO'a Master_Hostname='$(hostname)'' client_install 431 debug_info "$ client_PassMaster_Hostname_echo_3"432 debug_info "$MI_client_PassMaster_Hostname_echo_3" 432 433 # debug_info "edit client_install done..." 433 434 } … … 448 449 # 打包安裝目錄(不含tomcat) 449 450 450 debug_info "$ make_client_install_echo_1"451 debug_info "$MI_make_client_install_echo_1" 451 452 # debug_info "function make_client_install..." 452 453 … … 460 461 mv NutchezForClientOf_$MasterIP_Address.tar.gz /home/nutchuser/nutchez/source 461 462 cp $Start_PATH/client_install $Start_PATH/client_install_func.sh /home/nutchuser/nutchez/source 463 # cp $Start_PATH/client_install $Start_PATH/client_install /home/nutchuser/nutchez/source 464 # cp $Start_PATH/client_install $Start_PATH/client_remove.sh /home/nutchuser/nutchez/source 465 # cp $Start_PATH/client_install $Start_PATH/lang* /home/nutchuser/nutchez/source 462 466 } 463 467 464 468 function start_up_tomcat () { 465 debug_info "$ start_up_tomcat_echo_1"469 debug_info "$MI_start_up_tomcat_echo_1" 466 470 # debug_info "start up tomcat..." 467 471 468 472 i=10 469 debug_info "$ start_up_tomcat_echo_2"473 debug_info "$MI_start_up_tomcat_echo_2" 470 474 until [ $i -lt 1 ] 471 475 do … … 474 478 done 475 479 su nutchuser -c "$Tomcat_HOME/bin/startup.sh" 476 debug_info "$ start_up_tomcat_echo_3"480 debug_info "$MI_start_up_tomcat_echo_3" 477 481 # debug_info "tomcat has been started..." 478 482 } … … 481 485 # client簡易步驟 482 486 function client_install_commands () { 483 show_info "$client_install_commands_echo_1" 484 show_info "$client_install_commands_echo_2" 485 show_info "$client_install_commands_echo_3" 486 show_info "$client_install_commands_echo_4" 487 show_info "$client_install_commands_echo_5" 488 show_info "$client_install_commands_echo_6" 489 show_info "$client_install_commands_echo_7" 490 487 show_info "$MI_client_install_commands_echo_1" 488 show_info "$MI_client_install_commands_echo_2" 489 show_info "$MI_client_install_commands_echo_3" 490 show_info "$MI_client_install_commands_echo_4" 491 show_info "$MI_client_install_commands_echo_5" 492 show_info "$MI_client_install_commands_echo_6" 493 show_info "$MI_client_install_commands_echo_7" 491 494 492 495 # show_info "Client Install Command as Follows:"
Note: See TracChangeset
for help on using the changeset viewer.