Setting environment variable for services managed with SMF

Solaris 10 uses the SMF-Framework to manage the services started in the
system.

The configuration is stored in a database and can be managed with the
command svccfg.

This week we had to reboot a lot of servers, because of changes of the
power cords.

After booting again, some systems fail to work, because on some of them
where tomcat's installed and the were started manually.

From here, I got a package with a SMF manifest for tomcat. 

The manifest uses some default-Values, which were not suitable for me.

svccfg -s tomcat:default
svc:/network/tomcat:default>setprop start/exec= astring: /opt/apache-tomcat-5.5.20/svc-tomcat start


and some other values.
The reason to change the path, was that the /lib directory is readonly in
a sparse zone.

To set the environment correctly, I found a solution in this blog,
how to set JAVA_HOME, CATALINA_HOME, CATALINA_BASE 


svccfg -s tomcat:default setenv -m stop JAVA_HOME /usr/java

The user is nobody to use for starting tomcat, so the installation directory
was also changed
chown -R nobody:nobody apache-tomcat-5.5.20


svcadm refresh tomcat 
svcadm enable tomcat 

started the service with the SMF-Framework.