SMF instance manipulation
Description
Dynamic SMF instance creation utility that uses technique described in “Managing instances within SMF” post.
Download
Version 1.0: svcinst-1.0.gz
Usage
- List service instances:
# svcinst some/service list default - Create instance:
# svcinst some/service create production # svcinst some/service create development # svcinst some/service list default production developmentThe created instances inherits properties from initial snapshot of default instance. Note that created instances are disabled - you must customize its properties using svccfg(1M) and than enable them with svcadm(1M).
- Delete instance:
# svcinst some/service list default production development # svcinst some/service delete development # svcinst some/service list default production
Please also see Tomcat SMF Manifest for additional examples
June 18th, 2008 at 4:26 am
Found a bug when creating instances with multiple environment variables.
Currently, multiple variables get combined into a single variable:
JAVA_HOME=”/usr/java CATALINA_HOME=/usr/local/tomcat”
Instead of:
JAVA_HOME=”/usr/java”
CATALINA_HOME=”/usr/local/tomcat”
This is due to how svccfg listprop formats [method]/environment properties:
start/environment astring “JAVA_HOME=/usr/java” “CATALINA_HOME=/usr/local/tomcat”
Here’s a sed script to replace the current perl invocation, which quotes more appropriately:
# Sed scripts:
# 1. Remove defaulted properties
# 2. Remove NONPERSISTENT properties
# 3. Remove valueless properties
# 4. Quote unquoted values
# 5. Escape quotes
# 6. Reformat to setprop format
sed \
-e ‘\#:default$#d’ \
-e ‘\#NONPERSISTENT$#d’ \
-e ‘\#^[^ ]* *[^ ]* *$#d’ \
-e ’s#^\([^ ]* *[^ ]* *\)\([^”]*\)$#\1″\2″#’ \
-e ’s#\([^\\]\)”#\1\\”#g’ \
-e ’s#^\([^ ]*\) *\([^ ]*\) *\(.*\)$#\1 = \2: (\3)#g’
It may not be perfect, but it works for the test cases I’ve come up with.
Many thanks,
Scott Severtson
Digital Measures