Changeset 142
- Timestamp:
- Jun 1, 2010, 5:34:00 PM (14 years ago)
- Location:
- nutchez-0.2/src/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
nutchez-0.2/src/test/client_install
r140 r142 24 24 yesno="no" 25 25 echo -e "\nYour master IP: $Master_IP_Address" 26 echo -e "Your Nutchuser Password: $Nutchuser_Passwd" 27 read -p "These data are cooect? (yes/no): " yesno 26 read -p "Is this data cooect? (yes/no): " yesno 28 27 29 28 if [ "$yesno" == "yes" ] || [ "$yesno" == "y" ] ; then … … 69 68 read 70 69 70 71 # 新增nutchuser 帳號時用 Nutchuser_Passwd 當密碼 72 creat_nutchuser_account 73 read 74 75 71 76 # scp nutchuser@master_ip:~ 把.ssh/目錄複製下來 72 77 # 當使用者輸入nutchuser 密碼時,將此密碼紀錄到Nutchuser_Passwd … … 75 80 read 76 81 77 # 新增nutchuser 帳號時用 Nutchuser_Passwd 當密碼78 creat_nutchuser_account $Nutchuser_Passwd79 read80 82 81 83 # 用scp 複製 master 的設定與安裝資料 -
nutchez-0.2/src/test/client_install_func.sh
r140 r142 39 39 echo -e "\nCheck dependent packages" 40 40 if [ "$Linux_Distribution" == "Ubuntu" ] || [ "$Linux_Distribution" == "Debian" ] ;then 41 echo -e "\nIt will install sime packages (expect, ssh, and dialog).\n" 41 42 aptitude install -y expect ssh dialog 42 43 # rpm 系列系統 43 44 elif [ "$Linux_Distribution" == "Fedora" ] || [ "$Linux_Distribution" == "CentOS" ] ;then 44 45 echo -e "Plz install expect, ssh, and dialog." 46 exit 47 else 48 echo -e "Plz install expect, ssh, and dialog." 49 exit 45 50 fi 46 51 } … … 66 71 echo -e "\n= check_sunJava (debug) =" 67 72 echo -e "\nNutchEz need Sun Java JDK 1.6.x or above version" 68 javaPath="/usr/" 69 70 test -e $javaPath/bin/java || read -p "Plz input specific Java path\ 71 (ex./opt/jvm/java-6-sun-1.6.0.20/): " javaPath 73 74 yesno="no" 75 while [ "$yesno" != "yes" ] 76 do 77 read -p "Plz input Sun Java home path (ex. '/usr/lib/jvm/java-6-sun-1.6.0.12' or using default '/usr' ): " javaPath 78 read -p "Your java is ${javaPath}/bin/java. Is it correct (yes/no): " yesno 79 done 80 81 test -z JavaPath && $javaPath="/usr" 72 82 73 83 if [ -e $javaPath/bin/java ]; then … … 128 138 } 129 139 140 130 141 # scp nutchuser@master_ip:~ 把.ssh/目錄複製下來 131 142 # 當使用者輸入nutchuser 密碼時,將此密碼紀錄到Nutchuser_Passwd … … 134 145 echo -e "\n= scp_master_nutchuser_sshkey (debug) =" 135 146 echo -e "mkdir -p /home/nutchuser/" 136 mkdir -p /home/nutchuser/ 137 rm -fr /home/nutchuser/.ssh 138 139 while [ ! -d "/home/nutchuser/.ssh" ] 140 do 141 while [ "$Nutchuser_Passwd" != "$Nutchuser_Passwd2" ] 142 do 143 echo -e "\n" 144 read -p "Plz input nutchuser password of master node: " Nutchuser_Passwd 145 read -p "plz input nutchuser password, again: " Nutchuser_Passwd2 146 if [ "$1" == "$Nutchuser_Passwd2" ]; then 147 echo "Two Passwords match." 148 else 149 echo "two passwords do not match, plz re-input nutchuser's password." 150 fi 151 done 152 153 unset Nutchuser_Passwd2 154 155 echo -e "scp nutchuser@$1:~/.ssh /home/nutchuser/" 156 expect -c "spawn scp -r -o StrictHostKeyChecking=no nutchuser@$1:~/.ssh /home/nutchuser/ 157 expect \"*: \" { send \"$Nutchuser_Passwd\r\" } 158 expect \"*: \" { send_user \"Password is error\" } 159 expect eof" 160 if [ ! -d "/home/nutchuser/.ssh" ]; then 161 echo -e "\nPassword is error, plz re-input nutchuser passwd of master node." 162 else 163 echo -e "\nscp correct." 164 fi 165 echo "chown -R nutchuser:nutchuser /home/nutchuser/.ssh" 166 chown -R nutchuser:nutchuser /home/nutchuser/.ssh 167 done 147 mkdir -p /home/nutchuser/.ssh/ 148 rm -fr /home/nutchuser/.ssh/* 149 150 unset Nutchuser_Passwd2 151 152 echo -e "scp nutchuser@$1:~/.ssh /home/nutchuser/" 153 expect -c "spawn scp -r -o StrictHostKeyChecking=no nutchuser@$1:~/.ssh /home/nutchuser/ 154 expect \"*: \" { send \"$Nutchuser_Passwd\r\" } 155 expect \"*: \" { send_user \"Password is error\" } 156 expect eof" 157 158 if [ -e "/home/nutchuser/.ssh/authorized_keys" ]; then 159 echo -e "\nscp correct." 160 else 161 echo -e "\nscp is error,\n(1)plz check nutchuser password in server\n(2)nutchuser's authorized_keys in server\n(3)server's network status" 162 exit 163 fi 164 165 echo "chown -R nutchuser:nutchuser /home/nutchuser/.ssh" 166 chown -R nutchuser:nutchuser /home/nutchuser/.ssh 167 168 168 } 169 169 … … 172 172 function creat_nutchuser_account(){ 173 173 echo -e "\n= creat_nutchuser_account (debug) =" 174 175 while [ "$Nutchuser_Passwd" != "$Nutchuser_Passwd2" ] 176 do 177 echo -e "\n" 178 read -p "Plz input nutchuser password of master node: " Nutchuser_Passwd 179 read -p "plz input nutchuser password, again: " Nutchuser_Passwd2 180 if [ "$Nutchuser_Passwd" == "$Nutchuser_Passwd2" ]; then 181 echo "Two Passwords match." 182 else 183 echo "two passwords do not match, plz re-input nutchuser's password." 184 fi 185 done 186 187 unset Nutchuser_Passwd2 174 188 175 189 if [ $(cat /etc/passwd | grep nutchuser) ]; then … … 178 192 set timeout 1 179 193 expect \"*: \" 180 send \"$ 1\r\"181 expect \"*: \" 182 send \"$ 1\r\"194 send \"$Nutchuser_Passwd\r\" 195 expect \"*: \" 196 send \"$Nutchuser_Passwd\r\" 183 197 expect eof" 184 198 else … … 188 202 set timeout 1 189 203 expect \"*: \" 190 send \"$ 1\r\"191 expect \"*: \" 192 send \"$ 1\r\"204 send \"$Nutchuser_Passwd\r\" 205 expect \"*: \" 206 send \"$Nutchuser_Passwd\r\" 193 207 expect eof" 194 208 fi … … 200 214 echo -e "\n= scp_packages (debug) =" 201 215 chmod 777 /opt 202 echo "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez //opt/"203 su nutchuser -c "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez //opt/"204 205 echo -e "\nchown -R nutchuser:nutchuser /opt/nutchez /"206 chown -R nutchuser:nutchuser /opt/nutchez /216 echo "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez /opt/" 217 su nutchuser -c "scp -r -o StrictHostKeyChecking=no nutchuser@$1:/opt/nutchez /opt/" 218 219 echo -e "\nchown -R nutchuser:nutchuser /opt/nutchez" 220 chown -R nutchuser:nutchuser /opt/nutchez 207 221 chmod 755 /opt 208 222 }
Note: See TracChangeset
for help on using the changeset viewer.