Reading time: 2 minutes
Less known Solaris Features: Resource Management - Part 6: Resource Management and SMF
A few days ago, i wrote about the Service Management Facility, a framework to manage services in Solaris. This framework enables Solaris to start services in a more intelligent manner. Albeit almost all services started by SMF are member of the project
system it doesn´t have to be this way. You can specify the project used for a service.
Assigning a project to an already running service
This method is described in the SMF FAQ. I will use an practical example. You run a server in the internet, but it´s under high load from spam bot. You´ve already created a project
sendmail and configured the resource management.
At the moment, the sendmail runs in the
How do you start it as a part of a different project? Okay, check for an already configured project.
# svcprop -p start/project smtp:sendmail
svcprop: Couldn't find property `start/project' for instance `svc:/network/smtp:sendmail'.
Okay, nothing defined … this makes it a little bit harder, because we can´t set the project only at the moment, as there is a bug in the restarter daemon. You need a fully populated start method. If the
svcprop run delivers you the name of a project, you can ignore the next block of commands:
Okay, now we can set the project property of the start method:
Now we have to refresh the configuration of the service. After refreshing the service we can check the property:
Okay, the new properties are active. Now restart the service:
Let´s check for the result:
Configuring the project in a SMF manifest
Okay, you have written your own application and want to run it under the control of the SMF. You can define the project for the service in the manifest. You have to define the project in the start method of the manifest:
That´s all. The important part is the seond row of the fragment. We define the project as a part of the startup method context. The rest is done as described in the SMF tutorial.