1 | #!/bin/bash |
---|
2 | # 語言的選擇 |
---|
3 | # source ./language_choise.sh |
---|
4 | # 匯入功能函數 |
---|
5 | source ./install_func.sh |
---|
6 | #source ./client_install_func.sh |
---|
7 | source ./install_lang.zh |
---|
8 | |
---|
9 | Work_Path="./" |
---|
10 | Work_Path_J=0 |
---|
11 | |
---|
12 | # Work Path setup |
---|
13 | echo $0 | grep '/' || Work_Path_J=1 |
---|
14 | if [ "$Work_Path_J" == "0" ]; then |
---|
15 | Work_Path=$(echo $0 | sed 's/install//') |
---|
16 | fi |
---|
17 | |
---|
18 | # Source functions |
---|
19 | source $Work_Path/client_install_func.sh |
---|
20 | ### real code ##### |
---|
21 | |
---|
22 | # 前置作業 |
---|
23 | # *.sh及nutchez-0.2-0531.tar.gz均在同一目錄下 |
---|
24 | |
---|
25 | function show_info () { |
---|
26 | if [ $? -eq 0 ]; then |
---|
27 | echo -e "\033[1;32;40m $1 \033[0m" |
---|
28 | fi |
---|
29 | } |
---|
30 | |
---|
31 | main () { |
---|
32 | check_info |
---|
33 | show_info $main_echo_1 |
---|
34 | # show_info "歡迎使用NutchEZ, 此安裝程序會為您新建一個nutchuser帳號並協助您設定密碼" |
---|
35 | set_install_information |
---|
36 | read -p "$main_echo_2" confirm |
---|
37 | # read -p "Please confirm your install infomation: 1.Yes 2.No " confirm |
---|
38 | if [ $confirm -eq 1 ]; then |
---|
39 | creat_nutchuser_account $Nutchuser_Passwd |
---|
40 | make_ssh_key |
---|
41 | |
---|
42 | # 解壓縮 |
---|
43 | tar -zxvf nutchezV2-current.tar.gz -C /opt/ |
---|
44 | Install_Nutch |
---|
45 | mkdir /var/nutchez |
---|
46 | chown -R nutchuser:nutchuser /opt/nutchez |
---|
47 | chown -R nutchuser:nutchuser /var/nutchez |
---|
48 | su nutchuser -c "mkdir /home/nutchuser/nutchez" |
---|
49 | su nutchuser -c "mkdir /home/nutchuser/nutchez/urls" |
---|
50 | su nutchuser -c "touch /home/nutchuser/nutchez/urls/urls.txt" |
---|
51 | su nutchuser -c "mkdir /home/nutchuser/nutchez/search" |
---|
52 | su nutchuser -c "mkdir /home/nutchuser/nutchez/source" |
---|
53 | su nutchuser -c "mkdir /home/nutchuser/nutchez/system" |
---|
54 | make_client_install |
---|
55 | |
---|
56 | # 啟動系統 |
---|
57 | format_HDFS |
---|
58 | start_up_NutchEZ |
---|
59 | start_up_tomcat |
---|
60 | # 安裝流程結束,並進入網頁管理頁面設定爬網網址...等 |
---|
61 | show_info $main_echo_3 |
---|
62 | # show_info "Install Successfully!!" |
---|
63 | show_info $main_echo_4 |
---|
64 | # show_info "Visit http://$MasterIP_Address:8080" |
---|
65 | client_install_commands |
---|
66 | elif [ $confirm -eq 2 ]; then |
---|
67 | main |
---|
68 | fi |
---|
69 | } |
---|
70 | |
---|
71 | main |
---|