In addition to what everyone else has already replied with, I do something like this

if [ conditional ]; then
        cat << EOF >> $zonecfg
add fs
set dir=/usr/local
set special=$dir/$zone/local
set type=lofs

Since the variables get substituted within the script, you can make the zone config very very specific according to what exists on the global, command line arguments, phase of moon, whatever.

Then feed it to zonecfg with the -f flag.

Good luck.


Today at 12:13, Patrick J. McEvoy <> wrote:


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

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 there any good general way to configure zones
by running a command or series of commands?

Thanks for any help,


Thomas Kris Kasner
Qualcomm Inc.
5775 Morehouse Drive
San Diego, CA 92121

"You want to be President?"
"Good. Put your hand on the book and say 'I Do'"
        "I Do"
"Done! Let's Eat."
                                G'Kar and Sheridan, Babylon 5-No Compromises

zones-discuss mailing list

Reply via email to