Commit f5b8764f authored by tywldx's avatar tywldx

修改mount的IP获取方式

parent 1ee7df8b
#!/bin/bash #!/bin/bash
target_ip=$1 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 config_files=/home/config_files
script_path=/home/qa-deploy-utils/qa_shell_script script_path=/home/qa-deploy-utils/qa_shell_script
pwd_path="/home/qa-deploy-utils/qa_shell_script" pwd_path="/home/qa-deploy-utils/qa_shell_script"
config_server="$pwd_path/config_server" config_server="$pwd_path/config_server"
project_path=`cat $config_server/get_env_ip.sh` project_path=`cat $config_server/get_env_ip.sh`
if [[ $target_ip == "ALL" ]]; then if [[ $target_ip == "ALL" ]]; then
for ip_last_num in $project_path for ip_last_num in $project_path
do do
IP_host=`sh $pwd_path_0/get-ip.sh $ip_last_num`
expect -c " expect -c "
set timeout 10 set timeout 10
spawn ssh root@${IP_host_first}${ip_last_num} spawn ssh root@${IP_host}
expect \"]#\" expect \"]#\"
send \"umount -l $script_path\\ \r\" send \"umount -l $script_path\\ \r\"
set timeout -1 set timeout -1
...@@ -36,16 +37,17 @@ if [[ $target_ip == "ALL" ]]; then ...@@ -36,16 +37,17 @@ if [[ $target_ip == "ALL" ]]; then
send \"mkdir $config_files\r\" send \"mkdir $config_files\r\"
set timeout -1 set timeout -1
expect \"]#\" expect \"]#\"
send \"mount -t nfs 192.168.4.3:/home/sub_config_file_dont_rm/${IP_host_first}${ip_last_num}/ $config_files\r\" send \"mount -t nfs 192.168.4.3:/home/sub_config_file_dont_rm/${IP_host}/ $config_files\r\"
set timeout -1 set timeout -1
expect \"]#\" expect \"]#\"
send \"exit\r\" send \"exit\r\"
expect eof;" expect eof;"
done done
else else
target_host=`sh $pwd_path_0/get-ip.sh $target_ip`
expect -c " expect -c "
set timeout 10 set timeout 10
spawn ssh root@${IP_host_first}${target_ip} spawn ssh root@${target_host}
expect \"]#\" expect \"]#\"
send \"umount -l /home/qa-deploy-utils/qa_shell_script\r\" send \"umount -l /home/qa-deploy-utils/qa_shell_script\r\"
expect \"]#\" expect \"]#\"
...@@ -64,7 +66,7 @@ else ...@@ -64,7 +66,7 @@ else
send \"mkdir $config_files\r\" send \"mkdir $config_files\r\"
set timeout -1 set timeout -1
expect \"]#\" 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 set timeout -1
expect \"]#\" expect \"]#\"
send \"exit\r\" 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