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

Last change on this file since 222 was 220, checked in by waue, 14 years ago

install :加入自動匯入source有可能的路徑
client_install 僅加入註解還沒修改,需要討論使用者如何使用最方便

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