Changeset 165 for nutchez-0.2/src


Ignore:
Timestamp:
Jun 8, 2010, 3:27:23 PM (14 years ago)
Author:
rock
Message:

管理介面初版完成

Location:
nutchez-0.2/src/test
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nutchez-0.2/src/test/add_hosts

    r162 r165  
    1212
    1313IPs=$(cat $1 | awk '{print $1}')
     14HOSTNAMEs=$(cat $1 | awk '{print $2}')
    1415
     16# 刪除相同的 ip 在 /etc/hosts 和 nutch_nodes
    1517for ip_addr in $(echo $IPs)
    1618do
     
    1921
    2022    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
    2925    fi
    3026done
     27
     28# 刪除相同的 hostname 在 /etc/hosts 和 nutch_nodes
     29for host_name in $(echo $HOSTNAMEs)
     30do
     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
     38done
     39
     40# 附加 nutch_nodes 到 /etc/hosts
     41cp -f /etc/hosts /etc/hosts.bak
     42cat $1 >> $2
  • nutchez-0.2/src/test/duplicate_del

    r162 r165  
    1111# Delete duplicating ip addresss in file
    1212IPs=$(cat $1 | grep -v 'ip6' | grep -v '#' | grep -v '^$' | awk '{print $1}')
     13cp -f $1 ${1}.bak
    1314
    1415for ip_add in $(echo $IPs)
     
    3031do
    3132    # line numbers
    32     host_nu=$(cat -n $1 | grep $host | awk '{print $1}')
     33    host_nu=$(cat -n $1 | grep "$host\$" | awk '{print $1}')
    3334    host_count=$(echo $host_nu | wc -w)
    3435 
  • nutchez-0.2/src/test/nutchez

    r162 r165  
    1818function prepare_check(){
    1919if [ ! -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 40
     20    $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[nutch_nodes Files]" \
     21    --msgbox "Fail: Don't find /home/nutchuser/nutch_nodes !!!" 10 40
    2222    exit
    2323fi
    2424
    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
    2728
    2829 if [ "$?" == "0" ]; then
    2930    ./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"
    3333 fi
    3434
     
    4040
    4141$DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" \
    42     --title "management options" \
     42    --title "[Management Options]" \
    4343        --menu "Plz choose: " 15 55 5 \
    44         "cluster_setup" "Setup your datanode & tasknode" \
     44        "cluster_setup" "Setup your datanode & tasktracker" \
    4545        "tomcat_switch" "Start/Stop/Restart Tomcat" \
    4646        "tomcat_port" "Change Tomcat port" \
     
    4949}
    5050
    51 ## Cluster Setup (datanode & tasknode) ##
     51## Cluster Setup (datanode & tasktracker) ##
    5252function cluster_setup(){
    5353
     
    6060#echo $dataNodes
    6161clusterSetup="/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]" \
    6363    --menu "Plz choose: " 10 65 3 \
    64     "start" "Start all datanodes & taskcrackers in cluster" \
    65     "stop" "Stop all datanodes & taskcrackers in cluster" \
     64    "start" "Start all datanodes & tasktrackers in cluster" \
     65    "stop" "Stop all datanodes & tasktrackers in cluster" \
    6666    "exit" "Exit" 2>$clusterSetup
    6767
     
    7070if [ "$(cat $clusterSetup)" == "start" ]; then
    7171    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"
    7373    /opt/nutchez/nutch/bin/hadoop-daemon.sh start datanode
    7474    /opt/nutchez/nutch/bin/hadoop-daemon.sh start tasktracker
    7575    for node in $(echo $node_list)
    7676    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"
    8181    done
    8282elif [ "$(cat $clusterSetup)" == "stop" ]; then
     
    8787    for node in $(echo $node_list)
    8888    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"
    9393    done
    9494else
     
    103103#read
    104104if [ -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 50
     105    $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Tomcat Status]" \
     106        --msgbox "Tomcat is runing in this system !!!" 7 50
    107107else
    108     $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "Tomcat Status" \
    109         --msgbox "Tomcat is not running in this system!!!" 7 50
     108    $DIALOG --clear --backtitle "= [NutchEz Management Interface] ~by NCHC =" --title "[Tomcat Status]" \
     109        --msgbox "Tomcat is not running in this system !!!" 7 50
    110110fi
    111111tomcatSwitch="/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]" \
    113113    --menu "Plz choose: " 15 55 4 \
    114114        "start" "Start tomcat" \
     
    136136
    137137if [ ! -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]" \
    139139        --msgbox "Fial: Don't find /opt/nutchez/tomcat/conf/server.xml !!!" 10 50
    140140    exit
    141141fi
    142142tomcatPort="/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]" \
    144144    --inputbox "Plz input port number for tomcat (default is 8080)" 10 55 2>$tomcatPort
    145145
     
    157157echo -e "lang_switch"
    158158langSwitch="/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]" \
    160160    --menu "Plz choose: " 15 55 3 \
    161161    "English" "English" \
Note: See TracChangeset for help on using the changeset viewer.