Changeset 165
- Timestamp:
- Jun 8, 2010, 3:27:23 PM (14 years ago)
- Location:
- nutchez-0.2/src/test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
nutchez-0.2/src/test/add_hosts
r162 r165 12 12 13 13 IPs=$(cat $1 | awk '{print $1}') 14 HOSTNAMEs=$(cat $1 | awk '{print $2}') 14 15 16 # 刪除相同的 ip 在 /etc/hosts 和 nutch_nodes 15 17 for ip_addr in $(echo $IPs) 16 18 do … … 19 21 20 22 if [ $jude == 0 ]; then 21 # 若有的話,直接取代 22 change_line=$(cat -n $2 | grep ${ip_addr} | awk '{print $1}') 23 hostname=$(cat $1 | grep $ip_addr | awk '{print $2}') 24 sed -i "${change_line}c $ip_addr $hostname" $2 25 else 26 # 若沒有,直接新增 27 hostname=$(cat $1 | grep $ip_addr | awk '{print $2}') 28 sed -i "\$a $ip_addr $hostname" $2 23 del_line=$(cat -n $2 | grep ${ip_addr} | awk '{print $1}') 24 sed -i "${del_line}d" $2 29 25 fi 30 26 done 27 28 # 刪除相同的 hostname 在 /etc/hosts 和 nutch_nodes 29 for host_name in $(echo $HOSTNAMEs) 30 do 31 jude=0 32 cat $2 | grep ${host_name} || jude=1 33 34 if [ $jude == 0 ]; then 35 del_line=$(cat -n $2 | grep ${host_name} | awk '{print $1}') 36 sed -i "${del_line}d" $2 37 fi 38 done 39 40 # 附加 nutch_nodes 到 /etc/hosts 41 cp -f /etc/hosts /etc/hosts.bak 42 cat $1 >> $2 -
nutchez-0.2/src/test/duplicate_del
r162 r165 11 11 # Delete duplicating ip addresss in file 12 12 IPs=$(cat $1 | grep -v 'ip6' | grep -v '#' | grep -v '^$' | awk '{print $1}') 13 cp -f $1 ${1}.bak 13 14 14 15 for ip_add in $(echo $IPs) … … 30 31 do 31 32 # line numbers 32 host_nu=$(cat -n $1 | grep $host| awk '{print $1}')33 host_nu=$(cat -n $1 | grep "$host\$" | awk '{print $1}') 33 34 host_count=$(echo $host_nu | wc -w) 34 35 -
nutchez-0.2/src/test/nutchez
r162 r165 18 18 function prepare_check(){ 19 19 if [ ! -e /home/nutchuser/nutch_nodes ]; then 20 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title " nutch_nodes Files:" \21 --msgbox "Fail: Don't find /home/nutchuser/nutch_nodes !!!" 10 4020 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[nutch_nodes Files]" \ 21 --msgbox "Fail: Don't find /home/nutchuser/nutch_nodes !!!" 10 40 22 22 exit 23 23 fi 24 24 25 $DIALOG --clear --defaultno --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "/etc/host Update" \ 26 --yesno "Do you want to update /etc/hosts!!!" 6 40 25 $DIALOG --clear --defaultno --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[/etc/host Update]" \ 26 --yesno "Do you want to update \"/etc/hosts\" !!!\n(First time to execute it, please update)" 6 50 27 27 28 28 29 if [ "$?" == "0" ]; then 29 30 ./duplicate_del /home/nutchuser/nutch_nodes 30 echo -e "\nPlz input root password to modify /etc/hosts !!!" 31 su root -c "./duplicate_del /etc/hosts" 32 su root -c "./add_hosts /home/nutchuser/nutch_nodes /etc/hosts" 31 echo -e "\nPlz input root password to update /etc/hosts !!!" 32 su root -c "./duplicate_del /etc/hosts && ./add_hosts /home/nutchuser/nutch_nodes /etc/hosts" 33 33 fi 34 34 … … 40 40 41 41 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" \ 42 --title " management options" \42 --title "[Management Options]" \ 43 43 --menu "Plz choose: " 15 55 5 \ 44 "cluster_setup" "Setup your datanode & task node" \44 "cluster_setup" "Setup your datanode & tasktracker" \ 45 45 "tomcat_switch" "Start/Stop/Restart Tomcat" \ 46 46 "tomcat_port" "Change Tomcat port" \ … … 49 49 } 50 50 51 ## Cluster Setup (datanode & task node) ##51 ## Cluster Setup (datanode & tasktracker) ## 52 52 function cluster_setup(){ 53 53 … … 60 60 #echo $dataNodes 61 61 clusterSetup="/tmp/clusterSetup" 62 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title " Datanode & Tasktracker Setup" \62 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Datanode & Tasktracker Setup]" \ 63 63 --menu "Plz choose: " 10 65 3 \ 64 "start" "Start all datanodes & task crackers in cluster" \65 "stop" "Stop all datanodes & task crackers in cluster" \64 "start" "Start all datanodes & tasktrackers in cluster" \ 65 "stop" "Stop all datanodes & tasktrackers in cluster" \ 66 66 "exit" "Exit" 2>$clusterSetup 67 67 … … 70 70 if [ "$(cat $clusterSetup)" == "start" ]; then 71 71 echo "/opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode" 72 echo "/opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracke "72 echo "/opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker" 73 73 /opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode 74 74 /opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker 75 75 for node in $(echo $node_list) 76 76 do 77 echo -e "ssh $node -c/opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode"78 # ssh $node -c"/opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode"79 echo -e "ssh $node -c/opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker"80 # ssh $node -c"/opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker"77 echo -e "ssh -o StrictHostKeyChecking=no $node /opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode" 78 # ssh -o StrictHostKeyChecking=no $node "/opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode" 79 echo -e "ssh -o StrictHostKeyChecking=no $node /opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker" 80 # ssh -o StrictHostKeyChecking=no $node "/opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker" 81 81 done 82 82 elif [ "$(cat $clusterSetup)" == "stop" ]; then … … 87 87 for node in $(echo $node_list) 88 88 do 89 echo -e "ssh $node -c/opt/nutchez/nutch/bin/hadoop-daemon.sh stop datanode"90 # ssh $node -c"/opt/nutchez/nutch/bin/hadoop-daemon.sh stop datanode"91 echo -e "ssh $node -c/opt/nutchez/nutch/bin/hadoop-daemon.sh stop tasktracker"92 # ssh $node -c"/opt/nutchez/nutch/bin/hadoop-daemon.sh stop tasktracker"89 echo -e "ssh -o StrictHostKeyChecking=no $node /opt/nutchez/nutch/bin/hadoop-daemon.sh stop datanode" 90 # ssh -o StrictHostKeyChecking=no $node "/opt/nutchez/nutch/bin/hadoop-daemon.sh stop datanode" 91 echo -e "ssh -o StrictHostKeyChecking=no $node /opt/nutchez/nutch/bin/hadoop-daemon.sh stop tasktracker" 92 # ssh -o StrictHostKeyChecking=no $node "/opt/nutchez/nutch/bin/hadoop-daemon.sh stop tasktracker" 93 93 done 94 94 else … … 103 103 #read 104 104 if [ -n "$pid_tc" ]; then 105 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title " Tomcat Status" \106 --msgbox "Tomcat is runing in this system !!!" 7 50105 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Tomcat Status]" \ 106 --msgbox "Tomcat is runing in this system !!!" 7 50 107 107 else 108 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title " Tomcat Status" \109 --msgbox "Tomcat is not running in this system !!!" 7 50108 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Tomcat Status]" \ 109 --msgbox "Tomcat is not running in this system !!!" 7 50 110 110 fi 111 111 tomcatSwitch="/tmp/tomcatSwitch" 112 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title " Tomcat Service Options" \112 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Tomcat Service Options]" \ 113 113 --menu "Plz choose: " 15 55 4 \ 114 114 "start" "Start tomcat" \ … … 136 136 137 137 if [ ! -e /opt/nutchez/tomcat/conf/server.xml ]; then 138 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title " Tomcat Servel.xml" \138 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Tomcat Servel.xml]" \ 139 139 --msgbox "Fial: Don't find /opt/nutchez/tomcat/conf/server.xml !!!" 10 50 140 140 exit 141 141 fi 142 142 tomcatPort="/tmp/tomcatPort" 143 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC = " --title " Tomcat Port Change" \143 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC = " --title "[Tomcat Port Change]" \ 144 144 --inputbox "Plz input port number for tomcat (default is 8080)" 10 55 2>$tomcatPort 145 145 … … 157 157 echo -e "lang_switch" 158 158 langSwitch="/tmp/langSwitch" 159 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title " Language Change" \159 $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Language Swaitch]" \ 160 160 --menu "Plz choose: " 15 55 3 \ 161 161 "English" "English" \
Note: See TracChangeset
for help on using the changeset viewer.