> Tribblix: Services

In Tribblix, all running services are controlled by SMF, the Service Management Facility. There are two key commands. The first is:


which lists the services and their status.

If you add the -a flag, then all services will be shown (by default, disabled services will be ignored). If you add the -p flag, then the running processes associated with each service will be listed.

Not all services have long-running processes associated with them. Many just run something the once (often at boot).

Normally, you would expect to see a long list of services that are online. Those are the active services. You may see a handful listed as legacy_run - SMF still supports the old init system that ran scripts from the /etc/rc*.d directories. These services aren't tracked. Any service in maintenance is broken, indicating a problem.

The first thing to do when investigating a problem with a service is to ask SMF to explain what's wrong, using:

  svcs -xv

The next thing is to check the logs associated with a service. These are normally found in /var/svc/log, but you can ask SMF where the log for a given service. For example, the name of the log file for the zones service would be shown by:

  svcs -L zones

You may also have log files associated with the application, but if an application is really broken it may not be able to write to its own logs. In that case it might write a helpful error to stdout or stderr, which will end up in the SMF logs.

You'll see that the services have a long name. This is called an FMRI (Fault Managed Resource Identifier). Generally, you don't need the full name, as the last unique element will suffice. The last part of the name, after the colon (:) is an instance. In most cases there's only the one copy of a service, the default) instance, but some services have multiple instances which can be controlled independently.

The other command you need is svcadm. For example, if you had nginx installed, then you could enable nginx with:

  svcadm enable nginx

Or disable it with:

  svcadm disable nginx

If you need to restart it, you can either run disable and enable, or simply:

  svcadm restart nginx

Imagine that nginx wasn't working, and ended up in the maintenance state. Once you've diagnosed and fixed the problem, you need to let SMF know that everything should be OK and it should try the service again:

  svcadm clear nginx

Index | Previous Section | Next Section

tribblix@gmail.com :: GitHub :: Privacy