Changeset 91
- Timestamp:
- Jul 7, 2009, 3:40:58 PM (15 years ago)
- Location:
- nutchez-0.1/bin
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
nutchez-0.1/bin/nutchez
r89 r91 7 7 # begining .. 8 8 9 #bin=`dirname "$0"`10 #bin=`cd "$bin"; pwd`11 9 12 10 #. "$bin"/nutchez-func.sh 13 11 12 export JAVA_HOME=/usr/lib/jvm/java-6-sun 13 export NUTCH_HOME=/opt/nutch 14 # export HADOOP_HOME=/opt/nutch 14 15 export NUTCH_CONF_DIR=~/.nutchez/conf 15 export HADOOP_CONF_DIR=~/.nutchez/conf16 # export HADOOP_CONF_DIR=~/.nutchez/conf 16 17 export NUTCH_LOG_DIR=~/.nutchez/log 17 18 18 if [ $JAVA_HOME = "" ];then19 export JAVA_HOME=/usr/lib/jvm/java-6-sun20 fi21 19 22 # export NUTCH_HOME=/opt/nutch 20 23 21 24 22 . /opt/nutch/bin/nutchez-func.sh -
nutchez-0.1/bin/nutchez-func.sh
r89 r91 20 20 chown -R $LOGNAME:$LOGNAME ~/.nutchez 21 21 fi 22 # export NUTCH_CONF_DIR=~/.nutchez 23 # export HADOOP_CONF_DIR=~/.nutchez 24 # export HADOOP_LOG_DIR=~/.nutchez/log 25 # . ~/.nutchez/hadoop-env.sh || . /etc/nutch/hadoop-env.sh 26 } 27 28 echo_vb () { 22 23 } 24 25 echo_dialog_v () { 29 26 if [ $VERB -eq 1 ]; then 30 27 $DIALOG --msgbox "$1" 16 51 … … 34 31 test_file () { 35 32 if ! test -e "$1" ; then 36 echo_ vb"test_file: \n can not find $1"33 echo_dialog_v "test_file: \n can not find $1" 37 34 echo "" > $1 38 35 else 39 echo_ vb"test_file: \n Touch $1 ! \n Its content is \n `cat $1`"36 echo_dialog_v "test_file: \n Touch $1 ! \n Its content is \n `cat $1`" 40 37 fi 41 38 } … … 43 40 check_if_root() { 44 41 if [ ! "$UID" = "0" ]; then 45 echo_ vb"Hi [$LOGNAME] !! "46 echo_ vb"You need to run this script \"`basename $0`\" as root."42 echo_dialog_v "Hi [$LOGNAME] !! " 43 echo_dialog_v "You need to run this script \"`basename $0`\" as root." 47 44 exit 1 48 45 fi … … 50 47 51 48 promote_tempfile () { 52 echo_ vb"7. chang tmp as txt"49 echo_dialog_v "7. chang tmp as txt" 53 50 rm ~/.nutchez/sav/n.*.txt 54 51 mv /tmp/n.urls.tmp ~/.nutchez/sav/n.urls.txt … … 59 56 60 57 clean_tempfile () { 61 echo_ vb"7. delete tmp"58 echo_dialog_v "7. delete tmp" 62 59 rm /tmp/n.*.tmp 63 60 } … … 75 72 cp ~/.nutchez/sav/n.urls.txt ~/.nutchez/urls/urls.txt 76 73 77 if [ -e ~/.nutchez/ nutch-site.xml ] ; then74 if [ -e ~/.nutchez/conf/nutch-site.xml ] ; then 78 75 # set nutch-site.xml 79 sed -i -e "4s/<value>[a-zA-Z0-9]*</<value>$ROBOT</" ~/.nutchez/ nutch-site.xml76 sed -i -e "4s/<value>[a-zA-Z0-9]*</<value>$ROBOT</" ~/.nutchez/conf/nutch-site.xml 80 77 fi 81 78 … … 99 96 show_urls (){ 100 97 # show urls : ok =0 ,cancel = 1 101 echo_ vb"2. show_urls !"98 echo_dialog_v "2. show_urls !" 102 99 test_file ~/.nutchez/sav/n.urls.txt 103 echo_ vb"2.1 test_file ~/.nutchez/sav return : $?"100 echo_dialog_v "2.1 test_file ~/.nutchez/sav return : $?" 104 101 # dialog begin 105 102 dialog --title "The URLS that you want" --editbox ~/.nutchez/sav/n.urls.txt 16 51 2>/tmp/n.urls.tmp 106 103 RET=$? 107 echo_ vb"2.1 cat url: `cat /tmp/n.urls.tmp`"104 echo_dialog_v "2.1 cat url: `cat /tmp/n.urls.tmp`" 108 105 return $RET 109 106 } … … 111 108 setup_robot () { 112 109 test_file ~/.nutchez/sav/n.robot.txt 113 echo_ vb"3. setup_robot"110 echo_dialog_v "3. setup_robot" 114 111 # dialog 115 112 dialog --nocancel --inputbox " This agent name \n" 16 51 "`cat ~/.nutchez/sav/n.robot.txt`" 2>/tmp/n.robot.tmp 116 echo_ vb"3.1 cat robot : `cat /tmp/n.robot.tmp`"113 echo_dialog_v "3.1 cat robot : `cat /tmp/n.robot.tmp`" 117 114 } 118 115 119 116 setup_crawler () { 120 echo_ vb"4. setup_crawler"117 echo_dialog_v "4. setup_crawler" 121 118 test_file ~/.nutchez/sav/n.crawler.txt 122 119 dialog --nocancel --inputbox " Depth \n " 16 51 "`cat ~/.nutchez/sav/n.crawler.txt`" 2>/tmp/n.crawler.tmp 123 echo_ vb"4.1 cat robot : `cat /tmp/n.robot.tmp`"120 echo_dialog_v "4.1 cat robot : `cat /tmp/n.robot.tmp`" 124 121 } 125 122 126 123 setup_tomcat () { 127 echo_ vb"5. setup_tomcat"124 echo_dialog_v "5. setup_tomcat" 128 125 test_file ~/.nutchez/sav/n.tomcat.txt 129 126 dialog --nocancel --inputbox " explorer port \n " 16 51 "`cat ~/.nutchez/sav/n.tomcat.txt`" 2>/tmp/n.tomcat.tmp 130 echo_ vb"5.1 cat tomcat : `cat /tmp/n.tomcat.tmp`"127 echo_dialog_v "5.1 cat tomcat : `cat /tmp/n.tomcat.tmp`" 131 128 } 132 129 133 130 final_confirm () { 134 echo_ vb"6. final_confirm : start =0 , back =1 "131 echo_dialog_v "6. final_confirm : start =0 , back =1 " 135 132 tempfile=/tmp/n.finalcheck.tmp 136 133 … … 145 142 146 143 MSG=`cat $tempfile` 147 echo_ vb"6.1 final message :\n $MSG"144 echo_dialog_v "6.1 final message :\n $MSG" 148 145 #read READ 149 146 $DIALOG --title "Check It !!" --clear \ … … 151 148 --yesno "$MSG" 26 51 152 149 RET=$? 153 echo_ vb"final return = $RET"150 echo_dialog_v "final return = $RET" 154 151 return $RET 155 152 } … … 165 162 start_crawl () { 166 163 167 echo_ vb"7. start_crawl"164 echo_dialog_v "7. start_crawl" 168 165 setup_nutchez 169 166 install_tomcat 170 echo_ vb"/opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH"171 echo_ vb"nutch conf dir = $NUTCH_CONF_DIR"167 echo_dialog_v "/opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH" 168 echo_dialog_v "nutch conf dir = $NUTCH_CONF_DIR" 172 169 /opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH -topN 5000 -threads 1000 173 170 } 174 171 175 172 start_tomcat () { 176 echo_ vb"8. start_tomcat "177 echo_ vb"/opt/nutch/tomcat/bin/startup.sh"173 echo_dialog_v "8. start_tomcat " 174 echo_dialog_v "/opt/nutch/tomcat/bin/startup.sh" 178 175 if [ -e /tmp/search ];then 179 176 rm -rf /tmp/search … … 181 178 ln -sf ~/.nutchez/search/ /tmp/ 182 179 183 pid_tc=$(ps axw -eo pid,command | 184 grep "org.apache.catalina.startup.Bootstrap"\185 |grep "start" | awk '{print $1}')180 pid_tc=$(ps axw -eo pid,command |\ 181 grep "catalina.startup.Bootstrap" |\ 182 grep "start" | awk '{print $1}') 186 183 if [ -z "$pid_tc" ]; then 187 184 echo "starting tomcat" … … 201 198 202 199 show_report () { 203 echo_ vb"9. show_report "200 echo_dialog_v "9. show_report " 204 201 FIREFOX=`which firefox` 205 202 RET=$?
Note: See TracChangeset
for help on using the changeset viewer.