SMF is a great Solaris 10 feature, however it lacks some truly useful functionality. Imagine that you need to manage multiple instances of one service with different options or context (for example multiple Oracle instances or bunch of tomcats). How will you create this instances? Modify manifest and re-import it? Simply create legacy script for each instance? Here is the way for creating instances on the fly.
Create instance of service svc:/network/tomcat named devel:
# svccfg -s svc:/network/tomcat add devel
Copy propetry groups from initial snapshot of default instance (notice the line break between selectsnap last-import and listpg):
# svccfg -s svc:/network/tomcat:default "selectsnap last-import
listpg" |sed -e 's/NONPERSISTENT/P/' | \\
xargs -l svccfg -s svc:/network/tomcat:devel addpg
Copy properties from initial snapshot of default instance (notice the line break between selectsnap last-import and listprop):
# svccfg -s svc:/network/tomcat:default "selectsnap last-import
listprop" | perl -ne 'print $_ if \\
s#^([^ ]+/[^ ]+) *([^ ]+) *(.*)$#$1 = $2: (\\"$3\\")#' | \\
xargs -l svccfg -s svc:/network/tomcat:devel setprop
Setup and start new instance:
# svcadm refresh svc:/network/tomcat:devel
# svccfg -s svc:/network/tomcat:devel \\
setprop catalina_home = "/usr/local/tomcat"
# svccfg -s svc:/network/tomcat:devel \\
setprop java_home = "/usr/local/java"
# svcadm enable svc:/network/tomcat:devel
Please see “SMF Instance Manipulation” and “Tomcat SMF Manifest” for more information.
ogomnoe thank you, for your help, it that I searched, I a long ago am flustered by this question