Commit f5b8764f authored by tywldx's avatar tywldx

修改mount的IP获取方式

parent 1ee7df8b
#!/bin/bash
target_ip=$1
IP_host_first="192.168.4."
pwd_path_0="/home/qa-deploy-utils"
target_db_host=`sh $pwd_path/get-ip.sh $ip_value`
config_files=/home/config_files
script_path=/home/qa-deploy-utils/qa_shell_script
pwd_path="/home/qa-deploy-utils/qa_shell_script"
config_server="$pwd_path/config_server"
project_path=`cat $config_server/get_env_ip.sh`
if [[ $target_ip == "ALL" ]]; then
for ip_last_num in $project_path
do
expect -c "
set timeout 10
spawn ssh root@${IP_host_first}${ip_last_num}
expect \"]#\"
send \"umount -l $script_path\\ \r\"
set timeout -1
expect \"]#\"
send \"rm -rf $script_path\r\"
set timeout -1
expect \"]#\"
send \"mkdir -p $script_path\r\"
set timeout -1
expect \"]#\"
send \"mount -t nfs 192.168.4.3:$script_path $script_path\r\"
set timeout -1
expect \"]#\"
send \"umount -l $config_files\\ \r\"
set timeout -1
expect \"]#\"
send \"rm -rf $config_files\r\"
set timeout -1
expect \"]#\"
send \"mkdir $config_files\r\"
set timeout -1
expect \"]#\"
send \"mount -t nfs 192.168.4.3:/home/sub_config_file_dont_rm/${IP_host_first}${ip_last_num}/ $config_files\r\"
set timeout -1
expect \"]#\"
send \"exit\r\"
expect eof;"
done
do
IP_host=`sh $pwd_path_0/get-ip.sh $ip_last_num`
expect -c "
set timeout 10
spawn ssh root@${IP_host}
expect \"]#\"
send \"umount -l $script_path\\ \r\"
set timeout -1
expect \"]#\"
send \"rm -rf $script_path\r\"
set timeout -1
expect \"]#\"
send \"mkdir -p $script_path\r\"
set timeout -1
expect \"]#\"
send \"mount -t nfs 192.168.4.3:$script_path $script_path\r\"
set timeout -1
expect \"]#\"
send \"umount -l $config_files\\ \r\"
set timeout -1
expect \"]#\"
send \"rm -rf $config_files\r\"
set timeout -1
expect \"]#\"
send \"mkdir $config_files\r\"
set timeout -1
expect \"]#\"
send \"mount -t nfs 192.168.4.3:/home/sub_config_file_dont_rm/${IP_host}/ $config_files\r\"
set timeout -1
expect \"]#\"
send \"exit\r\"
expect eof;"
done
else
target_host=`sh $pwd_path_0/get-ip.sh $target_ip`
expect -c "
set timeout 10
spawn ssh root@${IP_host_first}${target_ip}
expect \"]#\"
send \"umount -l /home/qa-deploy-utils/qa_shell_script\r\"
expect \"]#\"
send \"mkdir -p /home/qa-deploy-utils/qa_shell_script\r\"
set timeout -1
set timeout 10
spawn ssh root@${target_host}
expect \"]#\"
send \"umount -l /home/qa-deploy-utils/qa_shell_script\r\"
expect \"]#\"
send \"mkdir -p /home/qa-deploy-utils/qa_shell_script\r\"
set timeout -1
expect \"]#\"
send \"mount -t nfs 192.168.4.3:/home/qa-deploy-utils/qa_shell_script /home/qa-deploy-utils/qa_shell_script\r\"
set timeout -1
......@@ -64,7 +66,7 @@ else
send \"mkdir $config_files\r\"
set timeout -1
expect \"]#\"
send \"mount -t nfs 192.168.4.3:/home/sub_config_file_dont_rm/${IP_host_first}${target_ip}/ $config_files\r\"
send \"mount -t nfs 192.168.4.3:/home/sub_config_file_dont_rm/${target_host}/ $config_files\r\"
set timeout -1
expect \"]#\"
send \"exit\r\"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment