1. Modify the IP in the JSON
$. IP. SH '8.8. 8.1 '
#!/bin/bash
#localIP =$ (command)
#
localip= '/sbin/ifconfig-a|grep inet|grep-v 127.0.0.1|grep-v inet6|grep 8|awk ' {print $} ' |tr-d ' addr: '
forIpinch$ ( Do if[${ip} = ="9.9.0.224" ] Then sed-i ' s/${ip}/${localip}/g '/. /env.json elif[${ip} = ="9.9.0.18" ] Then sed-i ' s/${ip}/$1/g '/. /env.json fi Done
2. Modify Envtype and Envuser
$./env. SH Test
1.Ansible call each agent script execution, to determine envtype= "solution" when the update to $
2.ssh [email protected]${ip}
"sed -i ‘s/1/3/g‘ /home/../json"
3. Nesting loops
for file in/home/.. /* . Jsondo echo "$file:" for ... Donedone
4. Determine which environment is
for file in/home/... /* If [-D "$file" && "$file" = = "Taskserver"] then echo "$file means localhost is server" elif [-D "$file" && $file "=" taskmaster "] then echo" " elif [-D" $file "&&" $file "= = "Env_agent"] then echo "" Fidone
Shell script--02 Modify the IP in the configuration file