source: nutchez-0.2/src/test/install_func.sh @ 139

Last change on this file since 139 was 139, checked in by shunfa, 14 years ago

修改install, install_func.sh, client_install_func.sh(新增帳號timeout部份)

  • Property svn:executable set to *
File size: 3.5 KB
RevLine 
[116]1#!/bin/bash
2source install_lang
[117]3####### garbage here #############
[116]4function mainFunction ( )
5{
6echo "$Good"
7}
8function braBraBra ( )
9{
10echo "$Bra_Bra_Bra"
11}
[117]12####### garbage end ###############
13
14####### fafa code here ###########
[137]15User_HOME=/home/nutchuser/nutchez
16NutchEZ_HOME=/opt/nutchez
17Nutch_HOME=$NutchEZ_HOME/nutch
18Tomcat_HOME=$NutchEZ_HOME/tomcat
19Index_DB=$User_HOME/search
[130]20MasterIP_Address=`/sbin/ifconfig eth0 | grep 'inet addr' |  sed 's/^.*addr://g' | sed 's/Bcast.*$//g' | sed 's/ .*// '`
[125]21
[137]22# DNS暫時以IP取代
23MasterDNS=$MasterIP_Address
[125]24
[137]25function set_install_information () { 
[139]26  set_nutchuser_passwd
27  read -p "Please enter Administrator's e-mail address: " Admin_email
28  read -p "Please enter the Master DNS:  " MasterDNS
29}
30
31function set_nutchuser_passwd () {
[137]32  read -p "Please enter nutchuser's password :  " nutchuser_passwd
33  read -p "Please enter nutchuser's password again:  " nutchuser_passwd_confirm
[139]34  if [ $nutchuser_passwd != $nutchuser_passwd_confirm ]; then
35    set_nutchuser_passwd
[137]36  fi
[117]37}
38
[137]39function show_info () {
[125]40  echo "Administrator's e-mail address is $Admin_email."
41  echo "The master DNS is: $MasterDNS"
[117]42}
43
[137]44function confirm_install_information () {
[117]45  read -p "Please confirm your install infomation: 1.Yes 2.No  " confirm
46}
47
[139]48function make_ssh_key () {
49  su nutchuser -c 'ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ""'
50  su nutchuser -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys"
51}
52
53
[137]54function set_haoop-site () {
55  echo "set $Nutch_HOME/conf/hadoop-site.xml"
56  cd $Nutch_HOME/conf/
[130]57  cat > hadoop-site.xml << EOF
[125]58<configuration>
[137]59  <property>
[125]60    <name>fs.default.name</name>
[137]61    <value>hdfs://$MasterIP_Address:9000</value>
62  </property>
63  <property>
[125]64    <name>mapred.job.tracker</name>
[137]65    <value>$MasterIP_Address:9001</value>
66  </property>
67  <property>
68    <name>hadoop.tmp.dir</name>
69    <value>/var/nutchez/nutch-nutchuser</value>
70  </property>
[125]71</configuration>
72EOF
[117]73}
74
[137]75# 修改nutch-site.xml中-http.agent.url, http.agent.email
76function set_nutch-site () {
77  echo "set $Nutch_HOME/conf/nutch-site.xml"
78  Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.url' | sed 's/:.*//g'`
79  echo "debug...http.agent.url line number = $Line_NO..."
80  sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml
81  echo "debug...edit http.agent.url delete line $((Line_NO+1))..."
82  sed -i ''$Line_NO'a <value>'$MasterIP_Address'</value>' $Nutch_HOME/conf/nutch-site.xml
83  echo "debug...edit http.agent.url done..."
[117]84
[137]85  Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.email' | sed 's/:.*//g'`
86  echo "debug...http.agent.email line number = $Line_NO..."
[126]87
[137]88  sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml
89  echo "debug...edit http.agent.email delete line $((Line_NO+1))..."
90  sed -i ''$Line_NO'a <value>'$Admin_email'</value>' $Nutch_HOME/conf/nutch-site.xml
91  echo "debug...edit http.agent.email done..."
[117]92}
93
[137]94function format_HDFS () {
[125]95  echo "format HDFS..."
[139]96  su nutchuser -c "$Nutch_HOME/bin/hadoop namenode -format"
[117]97}
98
[137]99function start_up_NutchEZ (){
[125]100  echo "start up NutchEZ..."
[139]101  su nutchuser -c "$Nutch_HOME/bin/start-all.sh"
[117]102}
103
[137]104function Install_Nutch () {
[136]105  set_haoop-site
106  set_nutch-site
107}
108
[139]109
110function make_client_install () {
111  # 將Master_IP_Address給client
112  # 打包安裝目錄(不含tomcat)
113  # tar -czv /opt/nutchez/nutch NutchezFor_$Master_IP_Client.tar.gz
114  echo "undo... function make_client_install"
[131]115}
116
[137]117function start_up_tomcat () {
[125]118  echo "start up tomcat..."
[139]119  sleep 10s
120  echo "su nutchuser -c "$Tomcat_HOME/bin/startup.sh""
121  su nutchuser -c "$Tomcat_HOME/bin/startup.sh"
[117]122}
Note: See TracBrowser for help on using the repository browser.