Skip to content

Instantly share code, notes, and snippets.

@j-c-m
Created January 11, 2019 02:15
Show Gist options
  • Select an option

  • Save j-c-m/773c7be7755fd71533dc32902085a8c8 to your computer and use it in GitHub Desktop.

Select an option

Save j-c-m/773c7be7755fd71533dc32902085a8c8 to your computer and use it in GitHub Desktop.
Managing instances within SMF
Managing instances within SMF
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.
UPDATE: Tomcat smf manifest and method can be obtained from here
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment