Changeset 128


Ignore:
Timestamp:
May 24, 2010, 4:58:57 PM (15 years ago)
Author:
rock
Message:

update 3 func(scp_master_nutchuser_sshkey, creat_nutchuser_account, scp_packages)
modify 1 func(check_sunJava)

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

Legend:

Unmodified
Added
Removed
  • nutchez-0.2/src/test/client_install.sh

    r127 r128  
    4040# 檢查是否有安裝sun java ,並檢查是否為jdk 1.6 以上版本
    4141check_sunJava
    42 #read
     42read
    4343
    4444# 檢查是否有安裝openssh, openssh-server
     
    5757# 當使用者輸入nutchuser 密碼時,將此密碼紀錄到Nutchuser_Passwd
    5858# 此步驟若無法連到 master 則跳出
    59 #scp_master_nutchuser_sshkey
     59scp_master_nutchuser_sshkey $Master_IP_Address
     60read
    6061
    6162# 新增nutchuser 帳號時用 Nutchuser_Passwd 當密碼
    62 #creat_nutchuser_account
     63creat_nutchuser_account $Nutchuser_Passwd
     64read
    6365
    6466# 用scp 複製 master 的設定與安裝資料
    6567# 目前僅需做到能無礙的複製遠端的/opt/nutchez/到local的/opt/
    66 #scp_packages
     68scp_packages $Master_IP_Address
     69read
    6770
    6871# 安裝
  • nutchez-0.2/src/test/client_install_func.sh

    r123 r128  
    1313function check_root(){
    1414# 正式版後可拿掉此 echo
    15 echo -e "\n= check_root ="
     15echo -e "\n= check_root (debug) ="
    1616if [ $USER != "root" ]; then
    1717    echo -e "\nPlz Change root to execute it!!!"
     
    2525# 查出此主機的作業系統,以及版本
    2626function check_systemInfo(){
    27 echo -e "\n= check_systemInfo ="
     27echo -e "\n= check_systemInfo (debug) ="
    2828echo -e "\nYour system information are:"
    2929lsb_release -a 2>/dev/null
     
    3434# 目前先檢查是否有/opt/nutchez 這個資料夾即可
    3535function check_nez_installed(){
    36     echo -e "\n= chcheck_nez_installed ="
    37     test -d /opt/nutchez && echo -e "\nYour system already had NutchEz." || \
    38     echo -e "\nYour system does not has NutchEz."
     36echo -e "\n= chcheck_nez_installed (debug) ="
     37test -d /opt/nutchez && echo -e "\nYour system already had NutchEz." || \
     38echo -e "\nYour system does not has NutchEz."
    3939}
    4040
     
    4444# (3)系統有安裝但Sun Java 在非預設路徑下 (4)以正確安裝 Sun JAVA 預設路徑下
    4545function check_sunJava(){
    46 echo -e "\n= check_sunJava ="
     46echo -e "\n= check_sunJava (debug) ="
    4747echo -e "\nNutchEz need Sun Java JDK 1.6.x or above version"
    4848javaPath="/usr/"
     
    6060        exit   
    6161    fi
    62    
    63     if [ $JAVA_version -lt "1.6" ]; then
     62   
     63    large16=$(echo "$JAVA_version >= 1.6" | bc)
     64    if [ "${large16}" == 0 ]; then
    6465        echo "Java version is too old (it need 1.6.X above)"
    6566        exit
    6667    fi
    67 
     68   
     69    echo "System has Sun Java 1.6 above version."
    6870else
    6971    echo "Plz install Sun JAVA 1.6.X or above version"
     
    7880# 檢查是否有安裝openssh, openssh-server
    7981function check_ssh(){
    80 echo -e "\n= check_ssh ="
     82echo -e "\n= check_ssh (debug) ="
    8183if [ -e /usr/bin/ssh ]; then
    8284    echo -e "\nSystem has ssh."
     
    9799# 檢查是否有安裝dialog
    98100function check_dialog(){
    99 echo -e "\n= check_dialog ="
     101echo -e "\n= check_dialog (debug) ="
    100102if [ -e /usr/bin/dialog ]; then
    101103    echo -e "\nSystem has dialog."
     
    109111# 檢查是否安裝 php 5.5
    110112function check_php(){
    111 echo -e "\n= check_php ="
     113echo -e "\n= check_php (debug) ="
    112114if [ "$(php -v 2>/dev/null | grep "PHP 5" | awk '{print $2}' | cut -d "." -f1)" == 5 ]; then
    113115    echo -e "\nPHP'version is 5"
    114116else
    115     echo -e "\nplz  install PHP 5 version"
     117    echo -e "\nplz install PHP 5 version!"
    116118#    exit
    117119fi
    118120}
     121
     122
     123# scp nutchuser@master_ip:~ 把.ssh/目錄複製下來
     124# 當使用者輸入nutchuser 密碼時,將此密碼紀錄到Nutchuser_Passwd
     125# 此步驟若無法連到 master 則跳出
     126function scp_master_nutchuser_sshkey(){
     127echo -e "\n= scp_master_nutchuser_sshkey (debug) ="
     128echo -e "mkdir -p /home/nutchuser/"
     129mkdir -p /home/nutchuser/
     130read -p "Plz input nutchuser passwd of mater node: " Nutchuser_Passwd
     131
     132echo -e "scp nutchuser@$1:~/.ssh /home/nutchuser/"
     133expect -c "spawn scp -r -o StrictHostKeyChecking=no nutchuser@$1:~/.ssh /home/nutchuser/
     134expect \"*: \"
     135send \"$Nutchuser_Passwd\r\"
     136expect eof"
     137
     138chown -R nutchuser:nutchuser /home/nutchuser/.ssh
     139}
     140
     141
     142# 新增nutchuser 帳號時用 Nutchuser_Passwd 當密碼
     143function creat_nutchuser_account(){
     144echo -e "\n= creat_nutchuser_account (debug) ="                             
     145read -p "Create nutchuser, plz input nutchuser's password: " Nutchuser_Passwd
     146useradd -m nutchuser -s /bin/bash
     147
     148expect -c "spawn passwd nutchuser                 
     149expect \"*: \"
     150send \"$1\r\"
     151expect \"*: \"
     152send \"$1\r\"
     153expect eof"
     154}
     155
     156
     157# 用scp 複製 master 的設定與安裝資料
     158# 目前僅需做到能無礙的複製遠端的/opt/nutchez/到local的/opt/
     159function scp_packages(){
     160echo -e "\n= scp_packages (debug) ="
     161echo "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez/ /opt/"
     162scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez/ /opt/
     163
     164echo "chown -R nutchuser:nutchuser /opt/nutchez/"
     165chown -R nutchuser:nutchuser /opt/nutchez/
     166}
Note: See TracChangeset for help on using the changeset viewer.