source: nutchez-0.2/src/shell/install @ 244

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

修改驗證資料夾及語言檔

  • Property svn:executable set to *
File size: 2.5 KB
Line 
1#!/bin/bash
2#
3
4# 變數宣告
5
6Work_Path=`dirname "$0"`
7
8if [ -f $Work_Path/install_func.sh ];then
9  Work_Path=`cd "$Work_Path"; pwd`
10elif [ -f $Work_Path/bin/install_func.sh ];then
11  Work_Path=`cd "$Work_Path/bin"; pwd`;
12else
13  echo "Import install-function-library error !!! ";
14  exit 1;
15fi
16
17#Work_Path=./
18#Work_Path_J=0
19# Work Path setup
20#echo $0 | grep '/' || Work_Path_J=1
21#if [ "$Work_Path_J" == "0"  ]; then
22#    Work_Path=$(echo $0 | sed 's/install//')
23#fi
24
25# Source functions
26  source $Work_Path/install_func.sh;
27#  source $Work_Path/lang_link;
28### real code #####
29
30# 前置作業
31# *.sh及nutchez-0.2-0531.tar.gz均在同一目錄下
32
33function show_info () {
34  if [ $? -eq 0 ]; then
35    echo -e "\033[1;32;40m $1 \033[0m"
36  fi
37}
38
39main () {
40  load_default_lang
41  check_info
42  show_info "$MI_main_echo_1"
43# show_info "歡迎使用NutchEZ, 此安裝程序會為您新建一個nutchuser帳號並協助您設定密碼"
44  set_install_information
45  show_master_info
46  read -p "$MI_main_echo_2" confirm
47# read -p "Please confirm your install infomation: 1.Yes 2.No  " confirm
48  if [ $confirm -eq 1 ]; then
49    creat_nutchuser_account $Nutchuser_Passwd
50    make_ssh_key
51    # 解壓縮
52    # tar -zxvf nutchezV2-current.tar.gz -C /opt/
53    unzip_nV2_pack
54
55   
56    su nutchuser -c "mkdir /home/nutchuser/nutchez"
57    su nutchuser -c "mkdir /home/nutchuser/nutchez/urls"
58    su nutchuser -c "touch /home/nutchuser/nutchez/urls/urls.txt"
59    su nutchuser -c "mkdir /home/nutchuser/nutchez/search"
60    su nutchuser -c "mkdir /home/nutchuser/nutchez/source"
61    su nutchuser -c "mkdir /home/nutchuser/nutchez/system"   
62
63    Install_Nutch
64
65   if [ ! -d "/var/nutchez" ]; then
66     mkdir /var/nutchez
67   fi
68
69    # 建立 nutch 與 tomcat 的 logs 資料夾
70    mkdir /var/nutchez/tomcat-logs
71    ln -sf /var/nutchez/tomcat-logs /opt/nutchez/tomcat/logs
72    mkdir /var/nutchez/logs
73    ln -sf /var/nutchez/logs /opt/nutchez/nutch/logs
74
75    chown -R nutchuser:nutchuser /opt/nutchez
76    chown -R nutchuser:nutchuser /var/nutchez
77   
78    # 系統路徑鍊結
79    ln -sf /home/nutchuser/nutchez/system/nutchez /usr/local/bin/nutchez
80
81    make_client_install
82    # 啟動系統
83    format_HDFS
84    start_up_NutchEZ
85    start_up_tomcat   
86    # 安裝流程結束,並進入網頁管理頁面設定爬網網址...等 
87    show_info "$MI_main_echo_3"
88#   show_info "Install Successfully!!"
89    show_info "$MI_main_echo_4"
90#   show_info "Visit http://$MasterIP_Address:8080"
91    client_install_commands
92  elif [ $confirm -eq 2 ]; then
93    main
94  fi
95}
96
97main
Note: See TracBrowser for help on using the repository browser.