Changeset 129
- Timestamp:
- May 25, 2010, 3:32:41 PM (15 years ago)
- Location:
- nutchez-0.2/src/test
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
nutchez-0.2/src/test/client_install.sh
r128 r129 19 19 Linux_Version=""; 20 20 Nutchuser_Passwd="xxxxxxxx"; 21 22 # 參數詢問 23 yesno="no" 24 echo -e "\nYour master IP: $Master_IP_Address" 25 echo -e "Your Nutchuser Password: $Nutchuser_Passwd" 26 read -p "These data are cooect? (yes/no): " yesno 27 28 if [ "$yesno" == "no" ];then 29 echo "Plz edit these parameters of this file." 30 exit 31 else 32 # echo "yes" 33 fi 21 34 22 35 # 功能邏輯區 -
nutchez-0.2/src/test/client_install_func.sh
r128 r129 128 128 echo -e "mkdir -p /home/nutchuser/" 129 129 mkdir -p /home/nutchuser/ 130 read -p "Plz input nutchuser passwd of mater node: " Nutchuser_Passwd 131 132 echo -e "scp nutchuser@$1:~/.ssh /home/nutchuser/" 133 expect -c "spawn scp -r -o StrictHostKeyChecking=no nutchuser@$1:~/.ssh /home/nutchuser/ 134 expect \"*: \" 135 send \"$Nutchuser_Passwd\r\" 136 expect eof" 137 138 chown -R nutchuser:nutchuser /home/nutchuser/.ssh 130 131 while [ ! -d "/home/nutchuser/.ssh" ] 132 do 133 echo -e "\n" 134 read -p "Plz input nutchuser passwd of master node: " Nutchuser_Passwd 135 echo -e "scp nutchuser@$1:~/.ssh /home/nutchuser/" 136 expect -c "spawn scp -r -o StrictHostKeyChecking=no nutchuser@$1:~/.ssh /home/nutchuser/ 137 expect \"*: \" { send \"$Nutchuser_Passwd\r\" } 138 expect \"*: \" { send_user \"Passwd is error\" } 139 expect eof" 140 if [ ! -d "/home/nutchuser/.ssh" ]; then 141 echo -e "\nPasswd is error, plz re-input nutchuser passwd of master node." 142 else 143 echo -e "\nscp correct." 144 fi 145 echo "chown -R nutchuser:nutchuser /home/nutchuser/.ssh" 146 chown -R nutchuser:nutchuser /home/nutchuser/.ssh 147 done 139 148 } 140 149 … … 143 152 function creat_nutchuser_account(){ 144 153 echo -e "\n= creat_nutchuser_account (debug) =" 145 read -p "Create nutchuser, plz input nutchuser's password: " Nutchuser_Passwd 146 useradd -m nutchuser -s /bin/bash 147 148 expect -c "spawn passwd nutchuser 149 expect \"*: \" 150 send \"$1\r\" 151 expect \"*: \" 152 send \"$1\r\" 153 expect eof" 154 155 # 若沒 nutchuser_Passwd 的參數傳遞才將註解打開讓使用者字型輸入 156 #while [ "1" != "$Nutchuser_Passwd2" ] 157 #do 158 # read -p "Create nutchuser, plz input nutchuser's password: " Nutchuser_Passwd 159 # read -p "plz input nutchuser's password, again: " Nutchuser_Passwd2 160 161 # if [ "$1" == "$Nutchuser_Passwd2" ]; then 162 # echo "Two Passwords match." 163 # else 164 # echo "two passwords do not match, plz re-input nutchuser's password." 165 # fi 166 #done 167 168 #unset Nutchuser_Passwd2 169 170 if [ $(cat /etc/passwd | grep nutchuser) ]; then 171 echo "System already has nutchuser, change nutchuser password." 172 expect -c "spawn passwd nutchuser 173 expect \"*: \" 174 send \"$1\r\" 175 expect \"*: \" 176 send \"$1\r\" 177 expect eof" 178 else 179 echo "System already has nutchuser, create nutchuser and change password." 180 useradd -m nutchuser -s /bin/bash 181 expect -c "spawn passwd nutchuser 182 expect \"*: \" 183 send \"$1\r\" 184 expect \"*: \" 185 send \"$1\r\" 186 expect eof" 187 fi 154 188 } 155 189
Note: See TracChangeset
for help on using the changeset viewer.