Changeset 91


Ignore:
Timestamp:
Jul 7, 2009, 3:40:58 PM (15 years ago)
Author:
waue
Message:

fix some bugs

Location:
nutchez-0.1/bin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nutchez-0.1/bin/nutchez

    r89 r91  
    77# begining ..
    88
    9 #bin=`dirname "$0"`
    10 #bin=`cd "$bin"; pwd`
    119
    1210#. "$bin"/nutchez-func.sh
    1311
     12  export JAVA_HOME=/usr/lib/jvm/java-6-sun
     13  export NUTCH_HOME=/opt/nutch
     14#  export HADOOP_HOME=/opt/nutch
    1415  export NUTCH_CONF_DIR=~/.nutchez/conf
    15   export HADOOP_CONF_DIR=~/.nutchez/conf
     16#  export HADOOP_CONF_DIR=~/.nutchez/conf
    1617  export NUTCH_LOG_DIR=~/.nutchez/log
    1718
    18 if [ $JAVA_HOME = "" ];then
    19   export JAVA_HOME=/usr/lib/jvm/java-6-sun
    20 fi
    2119
    22 #  export NUTCH_HOME=/opt/nutch
     20
    2321
    2422. /opt/nutch/bin/nutchez-func.sh
  • nutchez-0.1/bin/nutchez-func.sh

    r89 r91  
    2020    chown -R $LOGNAME:$LOGNAME ~/.nutchez
    2121  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
     25echo_dialog_v () {
    2926  if [ $VERB -eq 1 ]; then
    3027    $DIALOG --msgbox "$1" 16 51
     
    3431test_file () {
    3532  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"
    3734    echo "" >  $1
    3835  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`"
    4037  fi
    4138}
     
    4340check_if_root() {
    4441   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."
    4744     exit 1
    4845   fi
     
    5047
    5148promote_tempfile () {
    52   echo_vb "7. chang tmp as txt"
     49  echo_dialog_v "7. chang tmp as txt"
    5350  rm ~/.nutchez/sav/n.*.txt
    5451  mv /tmp/n.urls.tmp ~/.nutchez/sav/n.urls.txt
     
    5956
    6057clean_tempfile () {
    61   echo_vb "7. delete tmp"
     58  echo_dialog_v "7. delete tmp"
    6259  rm /tmp/n.*.tmp
    6360}
     
    7572  cp ~/.nutchez/sav/n.urls.txt ~/.nutchez/urls/urls.txt
    7673
    77   if [ -e ~/.nutchez/nutch-site.xml ] ; then
     74  if [ -e ~/.nutchez/conf/nutch-site.xml ] ; then
    7875    # set nutch-site.xml
    79     sed -i -e "4s/<value>[a-zA-Z0-9]*</<value>$ROBOT</" ~/.nutchez/nutch-site.xml
     76    sed -i -e "4s/<value>[a-zA-Z0-9]*</<value>$ROBOT</" ~/.nutchez/conf/nutch-site.xml
    8077  fi
    8178
     
    9996show_urls (){
    10097  # show urls : ok =0 ,cancel = 1
    101   echo_vb "2. show_urls !"
     98  echo_dialog_v "2. show_urls !"
    10299  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 : $?"
    104101  # dialog begin
    105102  dialog --title "The URLS that you want" --editbox ~/.nutchez/sav/n.urls.txt 16 51 2>/tmp/n.urls.tmp
    106103  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`"
    108105  return $RET
    109106}
     
    111108setup_robot () {
    112109  test_file ~/.nutchez/sav/n.robot.txt
    113   echo_vb "3. setup_robot"
     110  echo_dialog_v "3. setup_robot"
    114111  # dialog
    115112  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`"
    117114}
    118115
    119116setup_crawler () {
    120   echo_vb "4. setup_crawler"
     117  echo_dialog_v "4. setup_crawler"
    121118  test_file ~/.nutchez/sav/n.crawler.txt
    122119  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`"
    124121}
    125122
    126123setup_tomcat () {
    127   echo_vb "5. setup_tomcat"
     124  echo_dialog_v "5. setup_tomcat"
    128125  test_file ~/.nutchez/sav/n.tomcat.txt
    129126  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`"
    131128}
    132129
    133130final_confirm () {
    134   echo_vb "6. final_confirm : start =0 , back =1 "
     131  echo_dialog_v "6. final_confirm : start =0 , back =1 "
    135132  tempfile=/tmp/n.finalcheck.tmp
    136133
     
    145142
    146143  MSG=`cat $tempfile`
    147   echo_vb "6.1 final message :\n $MSG"
     144  echo_dialog_v "6.1 final message :\n $MSG"
    148145  #read READ
    149146  $DIALOG --title "Check It !!" --clear \
     
    151148        --yesno "$MSG" 26 51
    152149  RET=$?
    153   echo_vb "final return = $RET"
     150  echo_dialog_v "final return = $RET"
    154151  return $RET
    155152}
     
    165162start_crawl () {
    166163
    167   echo_vb "7. start_crawl"
     164  echo_dialog_v "7. start_crawl"
    168165  setup_nutchez
    169166  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"
    172169  /opt/nutch/bin/nutch crawl ~/.nutchez/urls -dir ~/.nutchez/search -depth $DEPTH -topN 5000 -threads 1000
    173170}
    174171
    175172start_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"
    178175  if [ -e /tmp/search ];then
    179176    rm -rf /tmp/search
     
    181178  ln -sf ~/.nutchez/search/ /tmp/
    182179
    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}')
    186183  if [ -z "$pid_tc" ]; then
    187184      echo "starting tomcat"
     
    201198
    202199show_report () {
    203   echo_vb "9. show_report "
     200  echo_dialog_v "9. show_report "
    204201  FIREFOX=`which firefox`
    205202  RET=$?
Note: See TracChangeset for help on using the changeset viewer.