Oct 12

Modifying a Solaris SMF service

How to modify properties of a Solaris SMF service.

A customer of mine has an OpenSolaris machine, meaning I've just had my first exposure to Solaris from a system administration perspective. The Solaris documentation seems fairly complete, but is lacking in concrete examples. Listed below are some notes  for working with Solaris services (mainly for my own benefit).

I used the following cheatsheet heavily; I won't reproduce it here.

OpenSolaris Cheat Sheet

Service identifiers

Services in Solaris are identified by what the documentation refers to as FMRI: Fault Mangement Resource Idenitifiers. These are used throughout SMF, Solaris' Service Management Framework, for referring to services. Apache, for example is referred to as svc:/network/http. Services can be listed using the svcs command.

Services and Instances

There can be several instances of a given service; usually, however, you just use the default one (usually called default). An exception to this (on the OpenSolaris machine I have access to, at least) is Apache; the instance name is actually 'apache', so the full service is called svc:/network/http:apache. Postfix is more conventional, with an instance name of svc:/network/postfix:default.

The important thing to note is that properties can be set both at the service and instance level.

Setting Properties

Much of a service's behaviour can be configured by setting properties on the service. The key one mentioned above, the command line to start the service, is called 'start/exec'. The name is in two parts: 'start' is a property group, and 'exec' is a property name.

The following command will set the command to execute to start a service:

 svccfg -s svc:/virtualmin/mysite_com/Trac setprop \
start/exec = astring: \"/opt/local/bin/tracd\ -d\ \
--hostname=localhost -p\ 8000\ /home/trac/trac/project\"

Here we're setting the service up to run the standalone trac daemon. Note the usual shell escape characters. It's possible to run svcconfig interactively - if you do so, all the escaping of course isn't required. Also note that in this case, the property is set on the service directly, not the instance.

Once the property is set, you then need to refresh and restart the service:

svcadm refresh virtualmin/mysite_com/Trac
svcadm restart virtualmin/mysite_com/Trac

More to follow...

I'll use this blog post as a notepad for managing Solaris services.



I've disabled comments for now due to spam problems - I'll turn them back on when I've fixed it!

This won't be published anywhere, it's just in case I need to contact you.

You can use Markdown in your comments. Be sensible!

Sorry about this, but I don't want spam comments.