Modifying Solaris Zone Properties With a Loop.
To modify many Solaris Zone Properties, you can run a loop something like the below.
Example 1
for i in `zoneadm list -cv |grep wapp1|awk '{print $2}'`;do ipaddr=`zonecfg -z $i info anet |grep "allowed-address: 10"|awk '{print $2}'|sed 's,10.20.19,10.20.41,'`; zonecfg -z $i "add anet;set lower-link=webpriv0;set allowed-address=$ipaddr;end;commit" ;done
Example 2
for i in `zoneadm list -cv |grep wapp|awk '{print $2}'`;do ipaddr=`zonecfg -z $i info anet |grep "allowed-address: 10.20.19"|awk '{print $2}'|sed 's,10.20.19,10.20.21,'`; zonecfg -z $i "select anet lower-link=aggr1;set allowed-address=$ipaddr;set defrouter=10.20.20.1;end;commit;" ;done
Example 3
for i in `zoneadm list -cv|awk '{print $2}'|grep wapp`;do ipaddr=`grep -w $i /tmp/foo|awk '{print $1}'`;zonecfg -z $i "select anet lower-link=aggr1;set allowed-address=$ipaddr;set defrouter=10.20.18.1;end;commit"; done
Running the script after copy.
for i in `zoneadm list -cv |awk '{print $2}'|grep wapp`;do zlogin $i "cd /var/tmp/;tar xf Ldap_installs_silent.tar;cd ldap_installs; ./install.sh"; done