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

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

修改 install, install_func.sh

  • Property svn:executable set to *
File size: 3.2 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 () { 
26  read -p "Please enter nutchuser's password :  " nutchuser_passwd
27  read -p "Please enter nutchuser's password again:  " nutchuser_passwd_confirm
28  if [$nutchuser_passwd != $nutchuser_passwd_confirm]
29    set_install_information
30  fi
31  read -p "Please enter Administrator's e-mail address: " Admin_email
[125]32  read -p "Please enter the Master DNS:  " MasterDNS
[117]33}
34
[137]35function show_info () {
[125]36  echo "Administrator's e-mail address is $Admin_email."
37  echo "The master DNS is: $MasterDNS"
[117]38}
39
[137]40function confirm_install_information () {
[117]41  read -p "Please confirm your install infomation: 1.Yes 2.No  " confirm
42}
43
[137]44function set_haoop-site () {
45  echo "set $Nutch_HOME/conf/hadoop-site.xml"
46  cd $Nutch_HOME/conf/
[130]47  cat > hadoop-site.xml << EOF
[125]48<configuration>
[137]49  <property>
[125]50    <name>fs.default.name</name>
[137]51    <value>hdfs://$MasterIP_Address:9000</value>
52  </property>
53  <property>
[125]54    <name>mapred.job.tracker</name>
[137]55    <value>$MasterIP_Address:9001</value>
56  </property>
57  <property>
58    <name>hadoop.tmp.dir</name>
59    <value>/var/nutchez/nutch-nutchuser</value>
60  </property>
[125]61</configuration>
62EOF
[117]63}
64
[137]65# 修改nutch-site.xml中-http.agent.url, http.agent.email
66function set_nutch-site () {
67  echo "set $Nutch_HOME/conf/nutch-site.xml"
68  Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.url' | sed 's/:.*//g'`
69  echo "debug...http.agent.url line number = $Line_NO..."
70  sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml
71  echo "debug...edit http.agent.url delete line $((Line_NO+1))..."
72  sed -i ''$Line_NO'a <value>'$MasterIP_Address'</value>' $Nutch_HOME/conf/nutch-site.xml
73  echo "debug...edit http.agent.url done..."
[117]74
[137]75  Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.email' | sed 's/:.*//g'`
76  echo "debug...http.agent.email line number = $Line_NO..."
[126]77
[137]78  sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml
79  echo "debug...edit http.agent.email delete line $((Line_NO+1))..."
80  sed -i ''$Line_NO'a <value>'$Admin_email'</value>' $Nutch_HOME/conf/nutch-site.xml
81  echo "debug...edit http.agent.email done..."
[117]82}
83
[137]84function format_HDFS () {
[125]85  echo "format HDFS..."
[137]86  $Nutch_HOME/bin/hadoop namenode -format
[117]87}
88
[137]89function start_up_NutchEZ (){
[125]90  echo "start up NutchEZ..."
[137]91  $NutchE_HOME/bin/start-all.sh
[117]92}
93
[137]94function Install_Nutch () {
[136]95  set_hadoop-env
96  set_haoop-site
97  set_nutch-site
98}
99
[137]100function Install_Tomcat () {
101# 設定nutch的搜尋引擎頁面到tomcat 
102  cd $Nutch_HOME
[131]103  mkdir web
[137]104  cd web
105  jar -xvf ../nutch-1.0.war
106  mv $Tomcat_HOME/webapps/ROOT $Tomcat_HOME/webapps/ROOT-ori
107  cd $Nutch_HOME
108  mv $Nutch_HOME/web $Tomcat_HOME/webapps/ROOT
109  mkdir $Index_DB
[131]110}
111
[137]112function start_up_tomcat () {
[125]113  echo "start up tomcat..."
[137]114  $Tomcat_HOME/bin/startup.sh
[117]115}
Note: See TracBrowser for help on using the repository browser.