On Fri, Jun 12, 2009 at 8:13 PM, Patrick J.
McEvoy<no-re...@opensolaris.org> wrote:
> Folks,
>
> I am trying to configure zones by running a series of
> commands because I want to script setting up zones.
> The man page for zonecfg only shows interactive examples,
> and the PDF documentation suggests exporting a config,
> then editing it, then using zonecfg -f. I don't want to
> write expect scripts or edit files -- I just want to
> run some commands to create and modify zones.
>
> For the global scope, this works:
>
>    zonecfg -z zfoo set zonepath=/zonefs/zfoo
>
> But for other scopes I can't find an invocation that works.
> For example, if I would do this interactively:
>
>        zonecfg:zfoo> add net
>        zonecfg:zfoo:net> set physical=foonic0
>        zonecfg:zfoo:net> end
>        zonecfg:zfoo>
>
> how would I do it non-interactively? I can't find any
> invocation of zonecfg that lets me both specify scope
> and set a property. This works, but is dorky:
>
>        printf "add net\nset physical=foonic0\nend\n" | zonecfg -z zfoo
>
> So...is there any good general way to configure zones
> by running a command or series of commands?

I just have a file (call it input_file):

create
set zonepath=/export/zones/mysql-node1
set autoboot=true
add net
set physical=nge0
set address=172.18.1.89/24
end
add fs
set dir=/opt/db
set special=/storage/db
set type=lofs
end
verify
commit


And then do

zonecfg -z zone_name -f input_file

(What I actually do is have a skeleton input file for each type of zone that
has parameter substitution run on it to create the above input file, but any
mechanism to build up the file would do.)

-- 
-Peter Tribble
http://www.petertribble.co.uk/ - http://ptribble.blogspot.com/
_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to