Changeset 94 for nutchez-0.1/bin/nutchez


Ignore:
Timestamp:
Jul 8, 2009, 2:20:41 PM (15 years ago)
Author:
waue
Message:

0.1-2 fix some bug

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nutchez-0.1/bin/nutchez

    r91 r94  
    1212  export JAVA_HOME=/usr/lib/jvm/java-6-sun
    1313  export NUTCH_HOME=/opt/nutch
    14 #  export HADOOP_HOME=/opt/nutch
    1514  export NUTCH_CONF_DIR=~/.nutchez/conf
    16 #  export HADOOP_CONF_DIR=~/.nutchez/conf
    1715  export NUTCH_LOG_DIR=~/.nutchez/log
    1816
     17. /opt/nutch/bin/nutchez-func.sh
     18
     19init_nutchez
    1920
    2021
     22tfile=`tempfile 2>/dev/null` || tfile=/tmp/test$$
     23trap "rm -f $tfile" 0 1 2 5 15
    2124
    22 . /opt/nutch/bin/nutchez-func.sh
    23 #. ~/.nutchez/hadoop-env.sh
     25$DIALOG --backtitle "Developed By NCHC" --clear --item-help --title "NutchEz 雛型版" \
     26        --menu " 你好,歡迎使用NutchEz! \n\
     27這套軟體是用來打造專屬於你的搜尋引擎 \n\
     28你有網頁不希望被公開的搜尋引擎找到, \n\
     29卻又希望能有個搜尋介面的困擾嗎? \n\
     30用NutchEz就對了!因為他操作簡單, \n\
     31除了基本的網頁以外,還支援多種格式(ppt,doc,txt...) \n\
     32並且是開源碼軟體,完全免費,安全無虞\n\
     33趕快來使用看看吧!\n\n\
     34          選擇你要的模式:" 20 60 4 \
     35        "1"  "開始建構搜尋內容"    "透過NutchEz來建構專屬於你自己所需的內容的搜尋引擎" \
     36        "2"  "開啟或關閉NutchEz的網頁伺服器"  "若您之前已經執行完1之後才需做網頁伺服器的管理" 2> $tfile
    2437
     38rev=$?
    2539
     40MAIN_CHOISE=`cat $tfile`
    2641
    27 init_nutchez
     42case $rev in
     43  0)
     44    echo_dialog_v "OK '$MAIN_CHOISE' chosen.";;
     45  1)
     46    echo_dialog_v "Cancel pressed."
     47    exit 0 ;;
     48  2)
     49    echo_dialog_v "HELP '$MAIN_CHOISE' chosen.";;
     50  255)
     51    echo_dialog_v "ESC pressed.";;
     52  *)
     53    echo_dialog_v "Unexpected code $MAIN_CHOISE";;
     54esac
     55
     56if [ $MAIN_CHOISE -eq 2 ];then
     57
     58  pid_tc=$(ps axw -eo pid,command |\
     59  grep "catalina" | grep "java" |\
     60  grep "start" | awk '{print $1}')
     61  if [ -z "$pid_tc" ]; then
     62      echo_dialog_v "0. pid = $pid_tc ! no another toddmcat is running"
     63
     64      $DIALOG --title "你的NutchEz網頁伺服器沒打開.." --clear \
     65        --yesno "\n 要開啟NutchEz的網頁伺服器嗎? \n" 15 61
     66      if [ $? -eq 0 ];then
     67          ~/.nutchez/tomcat/bin/startup.sh
     68    PORT=`cat ~/.nutchez/sav/n.tomcat.txt`
     69          $DIALOG --msgbox "已經試著開啟瀏覽伺服器,你可以瀏覽這個網址看看: \n  http://localhost:$PORT" 0 0
     70      else
     71    $DIALOG --msgbox "你選擇不要打開瀏覽伺服器!" 0 0
     72      fi
     73     
     74  else
     75      echo_dialog_v "0. tomcat had been started and the pid is $pid_tc"
     76
     77      $DIALOG --title "偵測到NutchEz的網頁伺服器正在運作.." --clear \
     78        --yesno "\n 你要關閉他嗎? \n" 15 61
     79      if [ $? -eq 0 ];then
     80          ~/.nutchez/tomcat/bin/shutdown.sh
     81    kill -9 $pid_tc
     82          $DIALOG --msgbox "已經試著關閉NutchEz網頁伺服器" 0 0
     83      else
     84          $DIALOG --msgbox "你選擇不要關閉瀏覽伺服器!" 0 0
     85      fi
     86
     87  fi
     88  exit 0
     89
     90elif [ $MAIN_CHOISE -eq 1 ];then
    2891
    2992CHECK=0
     
    3598    show_urls
    3699    URL=$?
    37     echo_vb "2.2 show_urls return $URL"
     100    echo_dialog_v "2.2 show_urls return $URL"
    38101   
    39102# add or delete url:  ok , exit
     
    63126  setup_tomcat
    64127
     128  # continue last search
     129  if [ -e ~/.nutchez/search ];then
     130    continue_previous
     131  fi
    65132  # show the final checklist
    66133  final_confirm
    67134  FC=$?
    68   echo_vb "6.3 final confirm return = $FC "
     135  echo_dialog_v "6.3 final confirm return = $FC "
    69136  #   START , back, cancel
    70137  # start =0 , back =1
     
    90157      ;;
    91158    255)
    92       echo_vb "ESC pressed !!"
     159      echo_dialog_v "ESC pressed !!"
    93160      ;;
    94161  esac
     
    108175# Done
    109176
     177
     178
     179
     180else
     181
     182  echo_dialog_v "Main Choise is $MAIN_CHOISE ! Error !!"
     183
     184fi
Note: See TracChangeset for help on using the changeset viewer.