zadmin
Purpose
zadmin is a simple shell script to make the administration of zones
in Solaris more easy.
zadmin is an enhancement to zoneadm with a slightly better user
interface (at least that's my opinion ...)
zadmin use zoneadm to maintain the zones.
Like all of my scripts based on scriptt.sh
zadmin also supports a configuration file in which you can define
defaults for the parameter.
Back to top
License
# CDDL HEADER START
#
# The contents of this file and the script are subject to the terms
of the
# Common Development and Distribution License, Version 1.0 only
# (the "License"). You may not use this file except in
compliance
# with the License.
#
# You can obtain a copy of the license at
usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own
identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
Back to top
History
Version
|
Releasedate
|
Description
|
v1.0.0
|
26.01.2013
|
initial release
|
|
|
|
Back to top
Operating system
Solaris 10 and newer
Back to top
Language / type
Kornshell Script
Back to top
Prerequisites
Zones support must be installed; the script can only run in the
global zone.
Back to top
Usage
The only mandatory parameter for zadmin
are action and at least
one zonename.
All other parameter are optional.
[26.01.2013 19:33:32] zadmin v1.0.0 started on Sat Jan 26 19:33:32
CET 2013
[26.01.2013 19:33:32] No config file ("zadmin.conf") found (use -C
to create a default config file)
zadmin v1.0.0 - Solaris zone administration tool
Usage: zadmin [-v|+v] [-q|+q] [-h] [-l logfile|+l] [-y|+y]
[-n|+n]
[-D|+D] [-a|+a] [-O|+O] [-f|+f] [-C] [-H] [-X] [-S n] [-V] [-T]
[-U|+U] [-F|+F] [-x|+x] [-i inputfile] [-o outputfile] [-z
zonename] action [zonename1][...][zonename#]
Note: Use -{switch} or --{longswitch} to turn an option on;
use +{switch} or
++{longswitch} to turn an option off
The long format of the
parameter (--parameter/++parameter) is not supported by all ksh
implementations
Parameter:
-v|+v - turn verbose mode on/off;
current value: y
Long format: --verbose / ++verbose
-q|+q - turn quiet mode on/off;
current value: n
Long format: --quiet / ++quiet
-h - show usage
Long format: --help
-l - set the
logfile
current value: /var/tmp/zadmin.LOG
Long format: --logfile
+l - do not write
a logfile
Long format: ++logfile
-y|+y - assume yes to all questions
or not
Long format: --yes / ++yes
-n|+n - assume no to all questions
or not
Long format: --no /++no
-D|+D - run main in single step
mode (and turn colors on); current value: n
Long format: --debug / ++debug
-a|+a - turn colors on/off; current
value: n
Long format: --color / ++color
-O|+O - overwrite existing files or
not; current value: n
Long format: --overwrite / ++overwrite
-f|+f - force; do it anyway;
current value: n
Long format: --force / ++force
-C - write a
default config file in the current directory and exit
Long format: --writeconfigfile
-H - write
extended usage to STDERR and exit
Long format: --doc
-X - write usage
examples to STDERR and exit
Long format: --view_examples
-S n - print error/warning
summaries:
n = 0 no summariess, 1 = print error msgs,
2 = print warning msgs, 3 = print error and warning mgs
Current value: 0
Long format: --summaries
-V - write
version number to STDOUT and exit
Long format: --version
-T - append
STDOUT and STDERR to the file "/var/tmp/zadmin.21367.tee.log"
Long format: --tee
-i inputfile
- file with a list of zones to process; current value:
Long format: --inputfile
Empty lines and lines beginning with a # are ignored
-o outputfile
- file with the list of zones processed by the script, current
value:
Long format: --outputfile
-U|+U - zonenames are regular
expressions or not; current value: y
Long format: --use_regular_expressions / ++use_regular_expressions
If this variable is true every zonename is interpreted as
zonename*
-F|+F - continue after a zoneadm
command ends with an error or not; current value: n
Long format: --continue_after_error / ++continue_after_error
-x|+x - dry run mode if true ,
current value: n
Long format: --dryrun / ++dryrun
In dry run mode no zoneadm command (except zoneadm list) is
executed.
Known action codes:
zadmin action code zoneadm
parameter
----------------------------------------
attach
attach
attach_and_update attach -u
attach_and_update_all attach -U
force_attach
attach -F
boot
boot
boot_single
boot -s
boot_verbose
boot -m verbose -v
boot_debug
boot -m debug -v
detach
detach
halt
halt
reboot
reboot
start
boot
stop
halt
restart
reboot
zonename can be either the name of a zone; a regular
expression for zonenames, or one of
all
-> process all zones
all_configured -> process all
configured zones
all_installed -> process
all installed zones
all_running ->
process all running zones
[26.01.2013 19:33:32] The log file used was
"/tmp/zadmin.21367.TEMP"
[26.01.2013 19:33:32] zadmin v1.0.0 ended on Sat Jan 26 19:33:32
CET 2013.
[26.01.2013 19:33:32] The RC is 1.
Examples
t61p Sat Jan 26 19:34:10
/data/www/myhomepage/htdocs/files/public/solaris/scripts #
/data/develop/scripts/zadmin -X
[26.01.2013 19:34:12] zadmin
v1.0.0 started on Sat Jan 26 19:34:12 CET 2013
[26.01.2013 19:34:12] No
config file ("zadmin.conf") found (use -C to create a default
config file)
-----------------------------------------------------------------------------------------------------
zadmin v1.0.0
Documentation - Examples
-----------------------------------------------------------------------------------------------------
# boot the zones
myzone001, myzone002, and myzone003
./zadmin boot
myzone00[1-3]
# start the zones
zone004, zone005, and zone006
./zadmin boot myzone004
zone005 zone006
# shutdown all zones
with a name starting with myzone00
./zadmin boot myzone00
# boot the zone with the
name myzone00
./zadmin -U boot
myzone00
# temporary shutdown all
running zones
# first halt all running
zones ; save the list of zones in a file
./zadmin -o
/var/tmp/running_zones.lst halt all_running
# do what's necessary ..
# now restart all halted
zones using the file created while stopping
# the zones
./zadmin -i
/var/tmp/running_zones.lst boot
[26.01.2013 19:34:12] The log
file used was "/tmp/zadmin.21404.TEMP"
[26.01.2013 19:34:12] zadmin
v1.0.0 ended on Sat Jan 26 19:34:12 CET 2013.
[26.01.2013 19:34:12] The RC
is 0.
Back to top
Internas
zadmin is based on my
script template for kornshell script: scriptt.sh
see also create_zone.sh - a script to
create zones in Solaris
Back to
top
Notes
Please see the source code of the script for additional information
Back to top
Download
Download zadmin
Back to top