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
Line 
1#!/bin/bash
2source install_lang
3####### garbage here #############
4function mainFunction ( )
5{
6echo "$Good"
7}
8function braBraBra ( )
9{
10echo "$Bra_Bra_Bra"
11}
12####### garbage end ###############
13
14####### fafa code here ###########
15User_HOME=/home/nutchuser/nutchez
16NutchEZ_HOME=/opt/nutchez
17Nutch_HOME=$NutchEZ_HOME/nutch
18Tomcat_HOME=$NutchEZ_HOME/tomcat
19Index_DB=$User_HOME/search
20MasterIP_Address=`/sbin/ifconfig eth0 | grep 'inet addr' |  sed 's/^.*addr://g' | sed 's/Bcast.*$//g' | sed 's/ .*// '`
21
22# DNS暫時以IP取代
23MasterDNS=$MasterIP_Address
24
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
32  read -p "Please enter the Master DNS:  " MasterDNS
33}
34
35function show_info () {
36  echo "Administrator's e-mail address is $Admin_email."
37  echo "The master DNS is: $MasterDNS"
38}
39
40function confirm_install_information () {
41  read -p "Please confirm your install infomation: 1.Yes 2.No  " confirm
42}
43
44function set_haoop-site () {
45  echo "set $Nutch_HOME/conf/hadoop-site.xml"
46  cd $Nutch_HOME/conf/
47  cat > hadoop-site.xml << EOF
48<configuration>
49  <property>
50    <name>fs.default.name</name>
51    <value>hdfs://$MasterIP_Address:9000</value>
52  </property>
53  <property>
54    <name>mapred.job.tracker</name>
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>
61</configuration>
62EOF
63}
64
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..."
74
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..."
77
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..."
82}
83
84function format_HDFS () {
85  echo "format HDFS..."
86  $Nutch_HOME/bin/hadoop namenode -format
87}
88
89function start_up_NutchEZ (){
90  echo "start up NutchEZ..."
91  $NutchE_HOME/bin/start-all.sh
92}
93
94function Install_Nutch () {
95  set_hadoop-env
96  set_haoop-site
97  set_nutch-site
98}
99
100function Install_Tomcat () {
101# 設定nutch的搜尋引擎頁面到tomcat 
102  cd $Nutch_HOME
103  mkdir web
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
110}
111
112function start_up_tomcat () {
113  echo "start up tomcat..."
114  $Tomcat_HOME/bin/startup.sh
115}
Note: See TracBrowser for help on using the repository browser.