I forgot also to mention that the zonemgr also has the ability
to run a command or series of commands in one, all, or specific
zones as well.  Here are a few examples.

Run uname -a in one zone:
# zonemgr -a runcmd -n zone1 -X "uname -a"

Run uname -a in all zones:
# zonemgr -a runcmd -n all -X "uname -a"

Run uname -a in specific zones:
# zonemgr -a runcmd -n "zone1 zone3" -X "uname -a"

Run a series of commands in all zones:
# zonemgr -a runcmd -n all -X "uname; ps -ef | grep syslog"

Regards,
Brad
http://opensolaris.org/os/project/zonemgr


On Sat, 2007-11-10 at 11:45 -0600, Brad Diggs wrote:
> If the action that you want to perform against all zones is to
> boot or halt, you can use the Zone Manager like so...
> 
> To halt all zones:
> zonemgr -a only -n haltall
> 
> To boot all zones:
> zonemgr -a only -n bootall
> 
> Or if you just want to run a command on all non-global zones,
> you can use the following script.
> 
> =-=-= Script Starts Here =-=-=
> #!/bin/sh
> runcmd="${*}"
> myzones=`zoneadm list -cp| cut -d: -f2 |grep -v global`
> for myzone in $myzones
> do
>    zlogin -S "${myzone}" "${runcmd}"
> done
> =-=-= Script Ends Here =-=-=
> 
> Regards,
> Brad
> The Zone Manager
> http://opensolaris.org/os/project/zonemgr
> 
> On Sat, 2007-11-10 at 12:35 +0000, Andrew Black (delete obvious bit)
> wrote:
> > Hi
> > i would like to  run same command on all zones.
> > Googling sauggests thet following, but the link is broken.
> > 
> > 
> > Blog O Matty  Solaris Zones - 12:29
> > While reading through Brendan Greggs Solaris zones tutorial, I ran across 
> > his zonerun script. This nifty little script allows you to run a command 
> > across ...
> > 
> > _______________________________________________
> > zones-discuss mailing list
> > zones-discuss@opensolaris.org
-- 
The Zone Manager
http://opensolaris.org/os/project/zonemgr

_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to