1 | #!/bin/bash |
---|
2 | |
---|
3 | # shell檔及壓縮檔在同一目錄中 |
---|
4 | ####### 環境變數section########### |
---|
5 | User_HOME=/home/nutchuser/nutchez |
---|
6 | NutchEZ_HOME=/opt/nutchez |
---|
7 | Nutch_HOME=$NutchEZ_HOME/nutch |
---|
8 | Tomcat_HOME=$NutchEZ_HOME/tomcat |
---|
9 | Index_DB=$User_HOME/search |
---|
10 | Admin_email=nutchuser@nutch |
---|
11 | # Work_Path=(define on install) |
---|
12 | Install_Dir=`cd "$Work_Path/../"; pwd` |
---|
13 | MasterIP_Address=`/sbin/ifconfig eth0 | grep 'inet addr' | sed 's/^.*addr://g' | sed 's/Bcast.*$//g' | sed 's/ .*// '` |
---|
14 | net_MacAddr=`/sbin/ifconfig eth0 | grep 'HW' | sed 's/^.*HWaddr //g'` |
---|
15 | |
---|
16 | ######function section####### |
---|
17 | |
---|
18 | ########## echo function ########## |
---|
19 | function debug_info () { |
---|
20 | if [ $? -eq 0 ]; then |
---|
21 | echo -e "\033[1;35;40m info - $1 \033[0m" |
---|
22 | fi |
---|
23 | } |
---|
24 | |
---|
25 | |
---|
26 | function show_info () { |
---|
27 | if [ $? -eq 0 ]; then |
---|
28 | echo -e "\033[1;32;40m $1 \033[0m" |
---|
29 | fi |
---|
30 | } |
---|
31 | ##########end echo function ########## |
---|
32 | |
---|
33 | function choose_lang(){ |
---|
34 | |
---|
35 | lang=$(locale | grep 'LANG=' | cut -d "=" -f2) |
---|
36 | |
---|
37 | # Default: source english |
---|
38 | . $Work_Path/install_lang.en |
---|
39 | # if locale is zh then source chinese |
---|
40 | echo $lang | grep 'zh' >> /dev/null && source $Work_Path/install_lang.zh |
---|
41 | |
---|
42 | # Ask language |
---|
43 | echo -e "\n$choose_lang_1" |
---|
44 | read -p "$choose_lang_2 " langChoice |
---|
45 | |
---|
46 | if [ $langChoice == "2" ]; then |
---|
47 | source $Work_Path/install_lang.zh |
---|
48 | else |
---|
49 | source $Work_Path/install_lang.en |
---|
50 | fi |
---|
51 | } |
---|
52 | |
---|
53 | function check_root(){ |
---|
54 | debug_info "check_root" |
---|
55 | if [ $USER != "root" ]; then |
---|
56 | show_info "$MI_check_root_1" |
---|
57 | exit |
---|
58 | fi |
---|
59 | show_info "$MI_check_root_2" |
---|
60 | } |
---|
61 | |
---|
62 | function check_systemInfo(){ |
---|
63 | debug_info "$MI_check_sys_1" |
---|
64 | show_info "$MI_check_sys_2" |
---|
65 | Linux_Distribution=$(lsb_release -a 2> /dev/null | grep "Distributor ID:" | awk '{print $3}') |
---|
66 | Linux_Version=$(lsb_release -a 2> /dev/null | grep "Release" | awk '{print $2}') |
---|
67 | show_info "$Linux_Distribution , $Linux_Version" |
---|
68 | } |
---|
69 | |
---|
70 | function install_packages(){ |
---|
71 | # deb 系列系統 |
---|
72 | debug_info "$MI_install_pack_1" |
---|
73 | debug_info "$MI_install_pack_2" |
---|
74 | if [ "$Linux_Distribution" == "Ubuntu" ] || [ "$Linux_Distribution" == "Debian" ] ;then |
---|
75 | echo -e "\n$MI_install_pack_if_1\n" |
---|
76 | aptitude install -y expect ssh dialog |
---|
77 | # rpm 系列系統 |
---|
78 | elif [ "$Linux_Distribution" == "Fedora" ] || [ "$Linux_Distribution" == "CentOS" ] ;then |
---|
79 | show_info "$MI_install_pack_if_2" |
---|
80 | else |
---|
81 | show_info "$MI_install_pack_if_2" |
---|
82 | fi |
---|
83 | } |
---|
84 | |
---|
85 | function unzip_nV2_pack(){ |
---|
86 | local pac_name=nutchez-0.2pack-current.tar.gz |
---|
87 | if [ ! -d "$Install_Dir/package" ];then |
---|
88 | mkdir $Install_Dir/package |
---|
89 | fi |
---|
90 | if [ ! -e "$Install_Dir/package/$pac_name" ];then |
---|
91 | wget "http://nutchez.googlecode.com/files/$pac_name"; |
---|
92 | if [ $? -eq 0 ];then |
---|
93 | mv $pac_name $Install_Dir/package; |
---|
94 | echo "movied"; |
---|
95 | else |
---|
96 | show_info "$pac_name not found, installation was not finished!"; |
---|
97 | exit 8; |
---|
98 | fi |
---|
99 | fi |
---|
100 | tar -zxvf $Install_Dir/package/$pac_name -C /opt/ |
---|
101 | } |
---|
102 | |
---|
103 | function check_nez_installed(){ |
---|
104 | debug_info "$MI_check_nez_1" |
---|
105 | if [ -d "/opt/nutchez" ]; then |
---|
106 | show_info "$MI_check_nez_2" |
---|
107 | exit |
---|
108 | else |
---|
109 | show_info "$MI_check_nez_3" |
---|
110 | fi |
---|
111 | } |
---|
112 | |
---|
113 | function check_sunJava(){ |
---|
114 | debug_info "$MI_check_sunJava_1" |
---|
115 | debug_info "$MI_check_sunJava_2" |
---|
116 | |
---|
117 | javaPath="/usr" |
---|
118 | yesno="no" |
---|
119 | choice="3" |
---|
120 | |
---|
121 | if [ -e $javaPath/bin/java ]; then |
---|
122 | JAVA_org=$($javaPath/bin/java -version 2>&1 | grep "Java(TM)") |
---|
123 | JAVA_version=$($javaPath/bin/java -version 2>&1 | grep "java version" | \ |
---|
124 | awk '{print $3}' | cut -d "." -f1-2 | cut -d "\"" -f2) |
---|
125 | |
---|
126 | if [ "$JAVA_org" == "" ]; then |
---|
127 | show_info "$MI_check_sunJava_if_1" |
---|
128 | show_info "$MI_check_sunJava_if_2" |
---|
129 | show_info "$MI_check_sunJava_if_3" |
---|
130 | read -p "$MI_check_sunJava_if_4" choice |
---|
131 | case $choice in |
---|
132 | "1") |
---|
133 | show_info "$MI_check_sunJava_if_5" |
---|
134 | exit |
---|
135 | ;; |
---|
136 | "2") |
---|
137 | read -p "$MI_check_sunJava_if_6" javaPath |
---|
138 | ;; |
---|
139 | "*") |
---|
140 | exit |
---|
141 | ;; |
---|
142 | esac |
---|
143 | |
---|
144 | if [ $choice == "2" ]; then |
---|
145 | JAVA_org=$($javaPath/bin/java -version 2>&1 | grep "Java(TM)") |
---|
146 | JAVA_version=$($javaPath/bin/java -version 2>&1 | grep "java version" | \ |
---|
147 | awk '{print $3}' | cut -d "." -f1-2 | cut -d "\"" -f2) |
---|
148 | |
---|
149 | if [ "$JAVA_org" == "" ]; then |
---|
150 | show_info "$MI_check_sunJava_if_7" |
---|
151 | exit |
---|
152 | fi |
---|
153 | fi |
---|
154 | fi |
---|
155 | |
---|
156 | large16=$(echo "$JAVA_version >= 1.6" | bc) |
---|
157 | if [ "${large16}" == 0 ]; then |
---|
158 | show_info "$MI_check_sunJava_if_8" |
---|
159 | exit |
---|
160 | fi |
---|
161 | |
---|
162 | show_info "$MI_check_sunJava_if_9" |
---|
163 | else |
---|
164 | show_info "$MI_check_sunJava_if_10" |
---|
165 | exit |
---|
166 | fi |
---|
167 | |
---|
168 | unset JAVA_org |
---|
169 | unset JAVA_version |
---|
170 | } |
---|
171 | |
---|
172 | # 檢查是否有安裝openssh, openssh-server |
---|
173 | function check_ssh(){ |
---|
174 | debug_info "$MI_check_ssh_1" |
---|
175 | if [ -e /usr/bin/ssh ]; then |
---|
176 | show_info "$MI_check_ssh_2" |
---|
177 | else |
---|
178 | show_info "$MI_check_ssh_3" |
---|
179 | exit |
---|
180 | fi |
---|
181 | |
---|
182 | if [ -e /usr/sbin/sshd ]; then |
---|
183 | show_info "$MI_check_ssh_4" |
---|
184 | else |
---|
185 | show_info "$MI_check_ssh_5" |
---|
186 | exit |
---|
187 | fi |
---|
188 | } |
---|
189 | |
---|
190 | |
---|
191 | # 檢查是否有安裝dialog |
---|
192 | function check_dialog(){ |
---|
193 | debug_info "$MI_check_dialog_1" |
---|
194 | if [ -e /usr/bin/dialog ]; then |
---|
195 | show_info "$MI_check_dialog_2" |
---|
196 | else |
---|
197 | show_info "$MI_check_dialog_3" |
---|
198 | exit |
---|
199 | fi |
---|
200 | } |
---|
201 | |
---|
202 | check_info () { |
---|
203 | check_root |
---|
204 | check_systemInfo |
---|
205 | install_packages |
---|
206 | check_nez_installed |
---|
207 | check_sunJava |
---|
208 | check_ssh |
---|
209 | check_dialog |
---|
210 | } |
---|
211 | |
---|
212 | function set_install_information () { |
---|
213 | set_nutchuser_passwd |
---|
214 | select_eth |
---|
215 | MasterIP_Address=$net_address |
---|
216 | } |
---|
217 | |
---|
218 | function set_nutchuser_passwd () { |
---|
219 | read -sp "$MI_set_nutchuser_passwd_echo_1" Nutchuser_Passwd |
---|
220 | # read -sp "Please enter nutchuser's password : " Nutchuser_Passwd |
---|
221 | echo -e "\n" |
---|
222 | read -sp "$MI_set_nutchuser_passwd_echo_2" Nutchuser_Passwd2 |
---|
223 | # read -sp "Please enter nutchuser's password again: " Nutchuser_Passwd2 |
---|
224 | echo -e "\n" |
---|
225 | if [ $Nutchuser_Passwd != $Nutchuser_Passwd2 ]; then |
---|
226 | set_nutchuser_passwd |
---|
227 | fi |
---|
228 | } |
---|
229 | |
---|
230 | # 新增nutchuser 帳號時用 Nutchuser_Passwd 當密碼 |
---|
231 | function creat_nutchuser_account(){ |
---|
232 | debug_info "$create_nutchuser_d1" |
---|
233 | while [ "$Nutchuser_Passwd" != "$Nutchuser_Passwd2" ] |
---|
234 | do |
---|
235 | echo -e "\n" |
---|
236 | read -sp "$create_nutchuser_1" Nutchuser_Passwd |
---|
237 | echo |
---|
238 | read -sp "$create_nutchuser_2" Nutchuser_Passwd2 |
---|
239 | echo |
---|
240 | if [ "$Nutchuser_Passwd" == "$Nutchuser_Passwd2" ]; then |
---|
241 | show_info "$create_nutchuser_3" |
---|
242 | else |
---|
243 | show_info "$create_nutchuser_4" |
---|
244 | fi |
---|
245 | done |
---|
246 | unset Nutchuser_Passwd2 |
---|
247 | |
---|
248 | if [ $(cat /etc/passwd | grep nutchuser) ]; then |
---|
249 | show_info "$create_nutchuser_s1" |
---|
250 | expect -c "spawn passwd nutchuser |
---|
251 | set timeout 1 |
---|
252 | expect \"*: \" |
---|
253 | send \"$Nutchuser_Passwd\r\" |
---|
254 | expect \"*: \" |
---|
255 | send \"$Nutchuser_Passwd\r\" |
---|
256 | expect eof" |
---|
257 | else |
---|
258 | show_info "$create_nutchuser_s2" |
---|
259 | useradd -m nutchuser -s /bin/bash |
---|
260 | expect -c "spawn passwd nutchuser |
---|
261 | set timeout 1 |
---|
262 | expect \"*: \" |
---|
263 | send \"$Nutchuser_Passwd\r\" |
---|
264 | expect \"*: \" |
---|
265 | send \"$Nutchuser_Passwd\r\" |
---|
266 | expect eof" |
---|
267 | fi |
---|
268 | } |
---|
269 | |
---|
270 | function select_eth () { |
---|
271 | net_interfaces=$(ifconfig | grep ^eth | cut -d " " -f1) |
---|
272 | net_nu=$(echo $net_interfaces | wc -w) |
---|
273 | |
---|
274 | # 若只有一個 eth 時 |
---|
275 | if [ "$net_nu" == "1" ]; then |
---|
276 | net_address=$(ifconfig $net_interfaces | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1) |
---|
277 | net_MacAddr=$(ifconfig $net_interfaces | grep 'HW' | sed 's/^.*HWaddr //g') |
---|
278 | |
---|
279 | # 若有多個 eth 時 |
---|
280 | else |
---|
281 | declare -i i=1 |
---|
282 | show_info "$MI_select_eth_echo_1" |
---|
283 | # show_info "\nSystem have multiple network device, which network use for this machine: " |
---|
284 | |
---|
285 | for net in $net_interfaces |
---|
286 | do |
---|
287 | show_info "($i) $net $(ifconfig $net | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1)" |
---|
288 | i=i+1 |
---|
289 | done |
---|
290 | read -p "$MI_select_eth_echo_2" net_choice |
---|
291 | # read -p "Please choice(1/2/3...): " net_choice |
---|
292 | if [ -z $net_choice ]; then |
---|
293 | net_choice=1 |
---|
294 | fi |
---|
295 | |
---|
296 | show_info "$MI_select_eth_echo_3 $net_choice" |
---|
297 | # show_info "Your choice is $net_choice" |
---|
298 | net_interface=$(echo $net_interfaces | cut -d " " -f $net_choice) |
---|
299 | #ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1 |
---|
300 | net_address=$(ifconfig $net_interface | grep "inet addr:" | sed 's/^.*inet addr://g' | cut -d " " -f1) |
---|
301 | net_MacAddr=$(ifconfig $net_interface | grep 'HW' | sed 's/^.*HWaddr //g') |
---|
302 | |
---|
303 | show_info "$MI_select_eth_echo_4 $net_address" |
---|
304 | # show_info "net_address is $net_address" |
---|
305 | show_info "$MI_select_eth_echo_5 $net_MacAddr" |
---|
306 | # show_info "net_MacAddr is $net_MacAddr" |
---|
307 | fi |
---|
308 | } |
---|
309 | |
---|
310 | |
---|
311 | function show_master_info () { |
---|
312 | show_info "$MI_show_master_info_echo_1 $MasterIP_Address" |
---|
313 | show_info "$MI_show_master_info_echo_2 $net_MacAddr" |
---|
314 | |
---|
315 | # show_info "The Master IP Address is $MasterIP_Address" |
---|
316 | # show_info "The Master MacAddr is $net_MacAddr" |
---|
317 | } |
---|
318 | |
---|
319 | function make_ssh_key () { |
---|
320 | debug_info "$MI_make_ssh_key_echo_1" |
---|
321 | # debug_info "Make ssh key(begin...)" |
---|
322 | su nutchuser -c 'ssh-keygen -t rsa -f ~/.ssh/id_rsa -P ""' |
---|
323 | su nutchuser -c "cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys" |
---|
324 | su nutchuser -c "ssh-add /home/nutchuser/.ssh/id_rsa" |
---|
325 | debug_info "$MI_make_ssh_key_echo_2" |
---|
326 | # debug_info "Make ssh key(done!)" |
---|
327 | } |
---|
328 | |
---|
329 | |
---|
330 | function set_haoop-site () { |
---|
331 | debug_info "$MI_set_haoop_site_echo_1" |
---|
332 | # debug_info "set hadoop-site.xml(begin...)" |
---|
333 | cd $Nutch_HOME/conf/ |
---|
334 | cat > hadoop-site.xml << EOF |
---|
335 | <configuration> |
---|
336 | <property> |
---|
337 | <name>fs.default.name</name> |
---|
338 | <value>hdfs://$MasterIP_Address:9000</value> |
---|
339 | </property> |
---|
340 | <property> |
---|
341 | <name>mapred.job.tracker</name> |
---|
342 | <value>$MasterIP_Address:9001</value> |
---|
343 | </property> |
---|
344 | <property> |
---|
345 | <name>hadoop.tmp.dir</name> |
---|
346 | <value>/var/nutchez/nutch-nutchuser</value> |
---|
347 | </property> |
---|
348 | </configuration> |
---|
349 | EOF |
---|
350 | debug_info "$MI_set_haoop_site_echo_2" |
---|
351 | # debug_info "set hadoop-site.xml(done!)" |
---|
352 | } |
---|
353 | |
---|
354 | # 修改nutch-site.xml中-http.agent.url, http.agent.email |
---|
355 | function set_nutch-site () { |
---|
356 | debug_info "$MI_set_nutch_site_echo_1" |
---|
357 | # debug_info "set nutch-site.xml(begin...)" |
---|
358 | Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.url' | sed 's/:.*//g'` |
---|
359 | debug_info "$MI_set_nutch_site_echo_2" |
---|
360 | # debug_info "debug...http.agent.url line number = $Line_NO..." |
---|
361 | sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml |
---|
362 | debug_info "$MI_set_nutch_site_echo_3" |
---|
363 | # debug_info "debug...edit http.agent.url delete line $((Line_NO+1))..." |
---|
364 | sed -i ''$Line_NO'a <value>'$MasterIP_Address'</value>' $Nutch_HOME/conf/nutch-site.xml |
---|
365 | debug_info "$MI_set_nutch_site_echo_4" |
---|
366 | # debug_info "debug...edit http.agent.url done..." |
---|
367 | |
---|
368 | Line_NO=`cat $Nutch_HOME'/conf/nutch-site.xml' | grep -n 'http.agent.email' | sed 's/:.*//g'` |
---|
369 | debug_info "$MI_set_nutch_site_echo_5" |
---|
370 | # debug_info "debug...http.agent.email line number = $Line_NO..." |
---|
371 | |
---|
372 | sed -i ''$((Line_NO+1))'d' $Nutch_HOME/conf/nutch-site.xml |
---|
373 | debug_info "$MI_set_nutch_site_echo_6" |
---|
374 | # debug_info "debug...edit http.agent.email delete line $((Line_NO+1))..." |
---|
375 | sed -i ''$Line_NO'a <value>'$Admin_email'</value>' $Nutch_HOME/conf/nutch-site.xml |
---|
376 | debug_info "$MI_set_nutch_site_echo_7" |
---|
377 | # debug_info "debug...edit http.agent.email done..." |
---|
378 | debug_info "$MI_set_nutch_site_echo_8" |
---|
379 | # debug_info "set nutch-site.xml(done!)" |
---|
380 | } |
---|
381 | |
---|
382 | function format_HDFS () { |
---|
383 | debug_info "$MI_format_HDFS_echo_1" |
---|
384 | su nutchuser -c "$Nutch_HOME/bin/hadoop namenode -format" |
---|
385 | debug_info "$MI_format_HDFS_echo_2" |
---|
386 | } |
---|
387 | |
---|
388 | function start_up_NutchEZ (){ |
---|
389 | debug_info "$MI_start_up_NutchEZ_echo_1" |
---|
390 | # debug_info "start up NutchEZ..." |
---|
391 | su nutchuser -c "$Nutch_HOME/bin/start-all.sh" |
---|
392 | } |
---|
393 | |
---|
394 | |
---|
395 | function set_hosts () { |
---|
396 | debug_info "$MI_set_hosts_echo_1" |
---|
397 | cp /etc/hosts /home/nutchuser/nutchez/system/hosts.bak |
---|
398 | Line_NO=`cat /etc/hosts | grep -n $(hostname) | sed 's/:.*//g'` |
---|
399 | content=$(cat /etc/hosts | awk 'NR=='$Line_NO'{printf "# " ; print}' ) |
---|
400 | sed -i ""$Line_NO"c $content" /etc/hosts |
---|
401 | sed -i '1i '$MasterIP_Address' '$(hostname)'' /etc/hosts |
---|
402 | } |
---|
403 | |
---|
404 | function Install_Nutch () { |
---|
405 | debug_info "$MI_install_Nutch_echo_1 $MasterIP_Address " |
---|
406 | # debug_info "MasterIP_Address=$MasterIP_Address" |
---|
407 | debug_info "$MI_install_Nutch_echo_2 $(hostname)" |
---|
408 | # debug_info "Master_Hostname=$(hostname)" |
---|
409 | su nutchuser -c "ssh localhost echo $net_address $(hostname) $net_MacAddr \>\> ~/nutchez/system/nutch_nodes" |
---|
410 | set_hosts |
---|
411 | set_haoop-site |
---|
412 | set_nutch-site |
---|
413 | } |
---|
414 | |
---|
415 | |
---|
416 | function client_PassMasterIPAddr () { |
---|
417 | cd $Work_Path |
---|
418 | Line_NO=`cat client_install | grep -n '# Master IP here' | sed 's/:.*//g'` |
---|
419 | debug_info "$MI_client_PassMasterIPAddr_echo_1" |
---|
420 | # debug_info "debug...Master IP here line number = $Line_NO..." |
---|
421 | sed -i ''$((Line_NO+1))'d' client_install |
---|
422 | debug_info "$MI_client_PassMasterIPAddr_echo_2" |
---|
423 | # debug_info "debug...edit Master IP at line $((Line_NO+1))..." |
---|
424 | sed -i ''$Line_NO'a Master_IP_Address='$MasterIP_Address'' client_install |
---|
425 | debug_info "$MI_client_PassMasterIPAddr_echo_3" |
---|
426 | # debug_info "edit client_install done..." |
---|
427 | } |
---|
428 | |
---|
429 | |
---|
430 | function client_PassMaster_Hostname () { |
---|
431 | cd $Work_Path |
---|
432 | Line_NO=`cat client_install | grep -n '# Master Hostname here' | sed 's/:.*//g'` |
---|
433 | debug_info "$MI_client_PassMaster_Hostname_echo_1" |
---|
434 | # debug_info "debug...Master hostname here line number = $Line_NO..." |
---|
435 | sed -i ''$((Line_NO+1))'d' client_install |
---|
436 | debug_info "$MI_client_PassMaster_Hostname_echo_2" |
---|
437 | # debug_info "debug...edit Master Hostname at line $((Line_NO+1))..." |
---|
438 | sed -i ''$Line_NO'a Master_Hostname='$(hostname)'' client_install |
---|
439 | debug_info "$MI_client_PassMaster_Hostname_echo_3" |
---|
440 | # debug_info "edit client_install done..." |
---|
441 | } |
---|
442 | |
---|
443 | function client_PassMasterIPAddr_for_Remove () { |
---|
444 | cd $Work_Path |
---|
445 | Line_NO=`cat client_remove | grep -n "# Master IP here" | sed 's/:.*//g'` |
---|
446 | sed -i ''$((Line_NO+1))'d' client_remove |
---|
447 | sed -i ''$Line_NO'a Master_IP_Address='$MasterIP_Address'' client_remove |
---|
448 | } |
---|
449 | |
---|
450 | |
---|
451 | function make_client_install () { |
---|
452 | # 建立資料夾(用來存放client的安奘檔) |
---|
453 | su nutchuser -c "mkdir $User_HOME/source" |
---|
454 | |
---|
455 | # 將Master_IP_Address給client |
---|
456 | # 打包安裝目錄(不含tomcat) |
---|
457 | |
---|
458 | debug_info "$MI_make_client_install_echo_1" |
---|
459 | # debug_info "function make_client_install..." |
---|
460 | |
---|
461 | client_PassMasterIPAddr |
---|
462 | client_PassMaster_Hostname |
---|
463 | client_PassMasterIPAddr_for_Remove |
---|
464 | cd /opt/nutchez/ |
---|
465 | su nutchuser -c "tar -cvzf NutchezForClientOf_$MasterIP_Address.tar.gz nutch" |
---|
466 | |
---|
467 | # 複製檔案至$User_HOME/source目錄下 |
---|
468 | mv NutchezForClientOf_$MasterIP_Address.tar.gz /home/nutchuser/nutchez/source |
---|
469 | cp $Work_Path/client_install $Work_Path/client_install_func.sh $Work_Path/client_remove $Work_Path/lang_link /home/nutchuser/nutchez/source |
---|
470 | cp -r $Work_Path/lang /home/nutchuser/nutchez/source |
---|
471 | cp -r $Work_Path/lang /home/nutchuser/nutchez/system |
---|
472 | cp $Work_Path/nutchez $Work_Path/lang_link $Work_Path/add_hosts $Work_Path/duplicate_del $Work_Path/master_remove /home/nutchuser/nutchez/system |
---|
473 | |
---|
474 | # 複製 nutchez/source 到使用者的安裝資料夾 |
---|
475 | |
---|
476 | mkdir $Install_Dir/Client_DIR |
---|
477 | cp -rf /home/nutchuser/nutchez/source/* $Install_Dir/Client_DIR/ |
---|
478 | |
---|
479 | # cp $Work_Path/client_install $Work_Path/client_install /home/nutchuser/nutchez/source |
---|
480 | # cp $Work_Path/client_install $Work_Path/client_remove /home/nutchuser/nutchez/source |
---|
481 | # cp $Work_Path/client_install $Work_Path/lang* /home/nutchuser/nutchez/source |
---|
482 | } |
---|
483 | |
---|
484 | function start_up_tomcat () { |
---|
485 | debug_info "$MI_start_up_tomcat_echo_1" |
---|
486 | # debug_info "start up tomcat..." |
---|
487 | |
---|
488 | i=10 |
---|
489 | debug_info "$MI_start_up_tomcat_echo_2" |
---|
490 | until [ $i -lt 1 ] |
---|
491 | do |
---|
492 | sleep 1s |
---|
493 | i=`expr $i - 1` |
---|
494 | done |
---|
495 | su nutchuser -c "$Tomcat_HOME/bin/startup.sh" |
---|
496 | debug_info "$MI_start_up_tomcat_echo_3" |
---|
497 | # debug_info "tomcat has been started..." |
---|
498 | } |
---|
499 | |
---|
500 | ###最後再整理### |
---|
501 | # client簡易步驟 |
---|
502 | function client_install_commands () { |
---|
503 | show_info "$MI_client_install_commands_echo_1" |
---|
504 | show_info "$MI_client_install_commands_echo_2" |
---|
505 | show_info "$MI_client_install_commands_echo_3" |
---|
506 | show_info "$MI_client_install_commands_echo_4" |
---|
507 | show_info "$MI_client_install_commands_echo_5" |
---|
508 | show_info "$MI_client_install_commands_echo_6" |
---|
509 | show_info "$MI_client_install_commands_echo_7" |
---|
510 | |
---|
511 | # show_info "Client Install Command as Follows:" |
---|
512 | # show_info "cd ~" |
---|
513 | # show_info "mkdir nutchez_client_install" |
---|
514 | # show_info "cd nutchez_client_install" |
---|
515 | # show_info "scp nutchuser@$MasterIP_Address:/home/nutchuser/nutchez/source/* ." |
---|
516 | # show_info "sudo su" |
---|
517 | # show_info "./client_install" |
---|
518 | } |
---|