sign in
Home | Updates | Pages | Users | Admin | Help

solsvc

Solaris Services

Generically, a service is an entity that provides a list of capabilities to applications and other services, local and remote. A service is dependent on an implicitly declared list of local services. In addition, a service can include less traditional entities such as the following:

  • A physical network device
  • A configured IP address
  • Kernel configuration information
  • Milestones that correspond to system init state, such as the multiuser run level

An instance is a specific configuration of a service. A web server is a service. A specific web server daemon that is configured to listen on port 80 is an instance. Each instance of the web server service could have different configuration requirements. Each service instance is named with a Fault Management Resource Identifier or FMRI. The FMRI includes the service name and the instance name. For example, the FMRI for the rlogin service is svc:/network/login:rlogin, where network/login identifies the service and rlogin identifies the service instance. Legacy init.d scripts are also represented with FMRIs that start with lrc instead of svc, for example: lrc:/etc/rcS_d/S35cacheos_sh. When booting a system for the first time with SMF, services listed in /etc/inetd.conf are automatically converted into SMF services

A milestone is a special type of service. Milestone services represent high-level attributes of the system. For example, the services which constitute run levels S, 2, and 3 are each represented by milestone services.

An SMF manifest is an XML file that contains a complete set of properties that are associated with a service or a service instance. The files are stored in /var/svc/manifest.

An SMF profile is an XML file that lists the set of service instances that are enabled when a system is booted. The profiles are stored in /var/svc/profile. These are some the profiles that are included:
  • generic_open.xml — This profile enables most of the standard internet services that have been enabled by default in earlier Solaris releases. This is the default profile.
  • generic_limited_net.xml — This profile disables many of the standard internet services. The sshd service and the NFS services are started, but most of the rest of the internet services are disabled.

svc.configd daemon is the arbiter of all requests to the local and remote repository datastores.

svc.startd daemon is the master process starter and restarter for the Solaris OS. The daemon is responsible for managing service dependencies for the entire system. The daemon takes on the previous responsibility that init held of starting the appropriate /etc/rcX.d scripts at the appropriate run levels. First, svc.startd retrieves the information in the service configuration repository. Next, the daemon starts services when their dependencies are met. The daemon is also responsible for restarting services that have failed and for shutting down services whose dependencies are no longer satisfied. The daemon keeps track of service state through an operating system view of availability through events such as process death.

Service States

  • degraded – The service instance is enabled, but is running at a limited capacity.
  • disabled – The service instance is not enabled and is not running.
  • legacy_run – The legacy service is not managed by SMF, but the service can be observed. This state is only used by legacy services.
  • maintenance – The service instance has encountered an error that must be resolved by the administrator.
  • offline – The service instance is enabled, but the service is not yet running or available to run.
  • online – The service instance is enabled and has successfully started.
  • uninitialized – This state is the initial state for all services before their configuration has been read.

Common services related tasks

List the Status of a Service

svcs -l FMRI

% svcs -l network/login:rlogin
fmri         svc:/network/login:rlogin
enabled      true
...

Showing the Status of Services Controlled by inetd

inetadm

Which Services Are Dependent on a Service Instance

svcs -D FMRI

% svcs -D milestone/multi-user
STATE          STIME    FMRI
online         Apr_08   svc:/milestone/multi-user-server:default

Which Services a Service Is Dependent On

svcs -d FMRI

% svcs -d milestone/multi-user:default
STATE          STIME    FMRI
disabled       Aug_24   svc:/platform/sun4u/sf880drd:default
online         Aug_24   svc:/milestone/single-user:default
online         Aug_24   svc:/system/utmp:default
...

View the relationships between services and processes

svcs -p FMRI svcs -pv FMRI

% svcs -pv system/sysevent:default
STATE          NSTATE        STIME    CTID   FMRI
online         -             16:11:21     28 svc:/system/sysevent:default
               16:11:21      138 syseventd
               16:11:31      376 devfsadm

An explanation of why a service isn’t running

svcs -x FMRI svcs -xv FMRI

% svcs -x system/zones:default
svc:/system/zones:default (Zones autoboot)
 State: online since Tue Oct 31 16:11:26 2006
 ...
% svcs -x network/rpc/bind:default
svc:/network/rpc/bind:default (RPC bindings)
 State: disabled since Wed Nov 01 12:03:11 2006
Reason: Disabled by an administrator.
...

Disable a Service Instance (superuser)

svcadm disable FMRI

WARNING: Check the dependents of the service you want to disable. If this service has dependents that you need, then you cannot disable this service.

# svcs -D network/login:rlogin
# svcadm disable network/login:rlogin
STATE          STIME    FMRI
# svcs network/login:rlogin
STATE          STIME    FMRI
disabled         11:17:24 svc:/network/login:rlogin

Enable a Service Instance (superuser)

svcadm enable FMRI

Determine whether service dependencies are satisfied. If the service is enabled, then the service dependencies are satisfied. If not, use svcadm enable -r FMRI to recursively enable all dependencies.

# svcs -l network/login:rlogin|grep enabled
enabled      false
# svcadm enable network/login:rlogin
# svcs network/login:rlogin
STATE          STIME    FMRI
online         12:09:16 svc:/network/login:rlogin

Enabling a Service in Single-user Mode (superuser)

The -t option starts the service in temporary mode which does not change the service repository. The repository is not writable in single-user mode. The -r option recursively starts all the dependencies of the named service.

# svcadm enable -rt rpc/bind

Sharing an NFS File System (restart a service – superuser)

To share a file system using the NFS service, you must define the file system in the /etc/dfs/dfstab file and then restart the NFS service.

# cat /etc/dfs/dfstab
  .
  .
  share -F nfs -o rw /export/home
# svcadm restart svc:/network/nfs/server

Modify a Command-Line Argument for an inetd Controlled Service (superuser)

inetadm -m FMRI exec=“command-syntax”

Example: Adding the Connection Logging _ Option to the _ftp Command

# inetadm -l svc:/network/ftp:default | grep exec
        exec="/usr/sbin/in.ftpd -a" 
# inetadm -m svc:/network/ftp:default exec="/usr/sbin/in.ftpd -a -l" 
# inetadm -l svc:/network/ftp:default
SCOPE    NAME=VALUE
         name="ftp" 
         endpoint_type="stream" 
         proto="tcp6" 
         isrpc=FALSE
         wait=FALSE
         exec="/usr/sbin/in.ftpd -a -l" 
 .
 .

Convert inetd.conf Entries

inetconv -i filename

The following procedure converts inetd.conf entries into SMF service manifests. This procedure needs to be run anytime a third-party application that depends on inetd is added to a system. Also run this procedure, if you need to make configuration changes to the entry in /etc/inetd.conf.

# inetconv -i /etc/inet/inetd.conf

See also

  • Managing SMF Services
  • How to Repair a Corrupt Repository/lib/svc/bin/restore_repository This procedure shows how to replace a corrupt repository with a default copy of the repository. When the repository daemon, svc.configd, is started, it does an integrity check of the configuration repository. This repository is stored in /etc/svc/repository.db.
  • Start Services Interactively During Boot—if problems with starting services occur, sometimes a system will hang during the boot. This procedure shows how to troubleshoot this problem.

Powered by JunebugWiki v0.0.31 Page last edited by stoyan on December 18, 2006 05:21 PM (diff)
[readonly] Version 2 (current) «olderversions