Using the svcs and svcadm Commands

Sun's Solaris 10 operating system allows programs that are expected to be running all of the time to be run as a service, which allows them to be automatically restarted. Sun defines a service as follows:

A Solaris service is any long-lived software object with a well-defined state, start and stop, and relationship to other services on the system. Delivering email, handling ftp requests, and permitting remote command execution are a few examples of services typically provided within the Solaris environment.

In Solaris 10, each software service has an advertised state. Should a failure occur, the system automatically diagnoses it and locates/pinpoints the source of the failure. Failing services are automatically restarted whenever possible, reducing the need for human intervention. Should manual intervention be required, system administrators can quickly identify the root cause of the service's failure and significantly reduce the times-to-repair and recover from said failure.

You can use the svcs -a command to see a list of all of the services on the system and their current state.

Aiseesoft Video Converter Ultimate 120x600

Over Eight Million Books w/ Free Shipping

Save Big at BiggerBooks.com
# svcs -a
STATE          STIME    FMRI
legacy_run     Oct_06   lrc:/etc/rcS_d/S50sk98sol
legacy_run     Oct_06   lrc:/etc/rc2_d/S10lu
legacy_run     Oct_06   lrc:/etc/rc2_d/S20sysetup
legacy_run     Oct_06   lrc:/etc/rc2_d/S40llc2
legacy_run     Oct_06   lrc:/etc/rc2_d/S42ncakmod
legacy_run     Oct_06   lrc:/etc/rc2_d/S47pppd
legacy_run     Oct_06   lrc:/etc/rc2_d/S70uucp
legacy_run     Oct_06   lrc:/etc/rc2_d/S72autoinstall
legacy_run     Oct_06   lrc:/etc/rc2_d/S73cachefs_daemon
legacy_run     Oct_06   lrc:/etc/rc2_d/S81dodatadm_udaplt
legacy_run     Oct_06   lrc:/etc/rc2_d/S89PRESERVE
legacy_run     Oct_06   lrc:/etc/rc2_d/S90wbem
legacy_run     Oct_06   lrc:/etc/rc2_d/S90webconsole
legacy_run     Oct_06   lrc:/etc/rc2_d/S94ncalogd
legacy_run     Oct_06   lrc:/etc/rc2_d/S95IIim
legacy_run     Oct_06   lrc:/etc/rc2_d/S98deallocate
legacy_run     Oct_06   lrc:/etc/rc2_d/S99audit
legacy_run     Oct_06   lrc:/etc/rc2_d/S99dtlogin
legacy_run     Oct_06   lrc:/etc/rc3_d/S16boot_server
legacy_run     Oct_06   lrc:/etc/rc3_d/S50apache
legacy_run     Oct_06   lrc:/etc/rc3_d/S52imq
legacy_run     Oct_06   lrc:/etc/rc3_d/S75seaport
legacy_run     Oct_06   lrc:/etc/rc3_d/S76snmpdx
legacy_run     Oct_06   lrc:/etc/rc3_d/S77dmi
legacy_run     Oct_06   lrc:/etc/rc3_d/S80mipagent
legacy_run     Oct_06   lrc:/etc/rc3_d/S81volmgt
legacy_run     Oct_06   lrc:/etc/rc3_d/S82initsma
legacy_run     Oct_06   lrc:/etc/rc3_d/S84appserv
legacy_run     Oct_06   lrc:/etc/rc3_d/S90samba
disabled       Oct_06   svc:/system/metainit:default
disabled       Oct_06   svc:/network/rpc/keyserv:default
disabled       Oct_06   svc:/network/rpc/nisplus:default
disabled       Oct_06   svc:/network/nis/server:default
disabled       Oct_06   svc:/network/nis/client:default
disabled       Oct_06   svc:/network/dns/client:default
disabled       Oct_06   svc:/network/ldap/client:default
disabled       Oct_06   svc:/network/nfs/cbd:default
disabled       Oct_06   svc:/network/nfs/mapid:default
disabled       Oct_06   svc:/network/inetd-upgrade:default
disabled       Oct_06   svc:/network/rpc/bootparams:default
disabled       Oct_06   svc:/network/nfs/server:default
disabled       Oct_06   svc:/network/rarp:default
disabled       Oct_06   svc:/network/dhcp-server:default
disabled       Oct_06   svc:/network/ipfilter:default
disabled       Oct_06   svc:/network/security/kadmin:default
disabled       Oct_06   svc:/network/security/krb5kdc:default
disabled       Oct_06   svc:/system/consadm:default
disabled       Oct_06   svc:/system/mdmonitor:default
disabled       Oct_06   svc:/application/print/server:default
disabled       Oct_06   svc:/network/dns/server:default
disabled       Oct_06   svc:/network/ntp:default
disabled       Oct_06   svc:/system/rcap:default
disabled       Oct_06   svc:/network/slp:default
disabled       Oct_06   svc:/system/sar:default
disabled       Oct_06   svc:/network/http:apache2
disabled       Oct_06   svc:/application/management/webmin:default
disabled       Oct_06   svc:/network/nis/passwd:default
disabled       Oct_06   svc:/network/nis/update:default
disabled       Oct_06   svc:/network/nis/xfr:default
disabled       Oct_06   svc:/application/gdm2-login:default
disabled       Oct_06   svc:/network/rpc/rex:default
disabled       Oct_06   svc:/network/rpc/spray:default
disabled       Oct_06   svc:/network/rpc/wall:default
disabled       Oct_06   svc:/network/tname:default
disabled       Oct_06   svc:/network/chargen:dgram
disabled       Oct_06   svc:/network/chargen:stream
disabled       Oct_06   svc:/network/daytime:dgram
disabled       Oct_06   svc:/network/daytime:stream
disabled       Oct_06   svc:/network/discard:dgram
disabled       Oct_06   svc:/network/discard:stream
disabled       Oct_06   svc:/network/echo:dgram
disabled       Oct_06   svc:/network/echo:stream
disabled       Oct_06   svc:/network/time:dgram
disabled       Oct_06   svc:/network/time:stream
disabled       Oct_06   svc:/network/comsat:default
disabled       Oct_06   svc:/network/login:eklogin
disabled       Oct_06   svc:/network/login:klogin
disabled       Oct_06   svc:/network/rexec:default
disabled       Oct_06   svc:/network/shell:kshell
disabled       Oct_06   svc:/network/talk:default
disabled       Oct_06   svc:/network/rpc/ocfserv:default
disabled       Oct_06   svc:/network/uucp:default
disabled       Oct_06   svc:/network/security/krb5_prop:default
disabled       Oct_06   svc:/network/apocd/udp:default
online         Oct_06   svc:/system/svc/restarter:default
online         Oct_06   svc:/network/pfil:default
online         Oct_06   svc:/milestone/name-services:default
online         Oct_06   svc:/network/loopback:default
online         Oct_06   svc:/system/filesystem/root:default
online         Oct_06   svc:/system/filesystem/usr:default
online         Oct_06   svc:/system/device/local:default
online         Oct_06   svc:/platform/i86pc/eeprom:default
online         Oct_06   svc:/milestone/devices:default
online         Oct_06   svc:/system/keymap:default
online         Oct_06   svc:/network/physical:default
online         Oct_06   svc:/milestone/network:default
online         Oct_06   svc:/system/filesystem/minimal:default
online         Oct_06   svc:/system/identity:domain
online         Oct_06   svc:/system/identity:node
online         Oct_06   svc:/system/name-service-cache:default
online         Oct_06   svc:/system/picl:default
online         Oct_06   svc:/application/print/cleanup:default
online         Oct_06   svc:/system/rmtmpfiles:default
online         Oct_06   svc:/system/sysevent:default
online         Oct_06   svc:/system/device/fc-fabric:default
online         Oct_06   svc:/system/coreadm:default
online         Oct_06   svc:/system/power:default
online         Oct_06   svc:/system/cryptosvc:default
online         Oct_06   svc:/system/manifest-import:default
online         Oct_06   svc:/milestone/single-user:default
online         Oct_06   svc:/system/filesystem/local:default
online         Oct_06   svc:/system/sysidtool:net
online         Oct_06   svc:/system/cron:default
online         Oct_06   svc:/network/initial:default
online         Oct_06   svc:/network/service:default
online         Oct_06   svc:/network/rpc/bind:default
online         Oct_06   svc:/system/sysidtool:system
online         Oct_06   svc:/network/nfs/status:default
online         Oct_06   svc:/network/nfs/nlockmgr:default
online         Oct_06   svc:/platform/i86pc/kdmconfig:default
online         Oct_06   svc:/milestone/sysconfig:default
online         Oct_06   svc:/system/sac:default
online         Oct_06   svc:/system/utmp:default
online         Oct_06   svc:/system/console-login:default
online         Oct_06   svc:/network/inetd:default
online         Oct_06   svc:/application/font/fc-cache:default
online         Oct_06   svc:/network/rpc/gss:default
online         Oct_06   svc:/network/rpc/mdcomm:default
online         Oct_06   svc:/network/rpc/meta:default
online         Oct_06   svc:/network/rpc/metamed:default
online         Oct_06   svc:/network/rpc/metamh:default
online         Oct_06   svc:/network/rpc/rstat:default
online         Oct_06   svc:/network/rpc/rusers:default
online         Oct_06   svc:/network/security/ktkt_warn:default
online         Oct_06   svc:/network/telnet:default
online         Oct_06   svc:/network/nfs/rquota:default
online         Oct_06   svc:/network/ftp:default
online         Oct_06   svc:/network/finger:default
online         Oct_06   svc:/network/login:rlogin
online         Oct_06   svc:/network/nfs/client:default
online         Oct_06   svc:/network/shell:default
online         Oct_06   svc:/application/x11/xfs:default
online         Oct_06   svc:/application/font/stfsloader:default
online         Oct_06   svc:/network/rpc/smserver:default
online         Oct_06   svc:/network/rpc-100235_1/rpc_ticotsord:default
online         Oct_06   svc:/network/rpc-100083_1/rpc_tcp:default
online         Oct_06   svc:/network/rpc-100068_2-5/rpc_udp:default
online         Oct_06   svc:/system/filesystem/autofs:default
online         Oct_06   svc:/system/dumpadm:default
online         Oct_06   svc:/system/system-log:default
online         Oct_06   svc:/network/smtp:sendmail
online         Oct_06   svc:/system/fmd:default
online         Oct_06   svc:/network/ssh:default
online         Oct_06   svc:/milestone/multi-user:default
online         Oct_06   svc:/milestone/multi-user-server:default
online         Oct_06   svc:/system/zones:default
offline        Oct_06   svc:/application/print/ipp-listener:default
offline        Oct_06   svc:/application/print/rfc1179:default

You can restrict the display to a particular service you are interested in by using svcs svcname, e.g. svcs apache2 to check the status of the Apache webserver service. Note: you can also use svcs http for Apache.

# svcs apache2
STATE          STIME    FMRI
disabled       Oct_06   svc:/network/http:apache2

Note: if you started the Apache webserver software with the apachectl command, the svcs apache2 command will still show the Apache service as "disabled", even though Apache itself is running, if you have not enabled it to run as a service. You can enable Apache to run as a service and start it running with svcadm enable apache2. If you then check its status with svcs, you should see it in the "online" state.

# svcs apache2
STATE          STIME    FMRI
online         14:05:00 svc:/network/http:apache2

If you wish to see all process ids associated with the service you can use the -p option.

# svcs -p apache2
STATE          STIME    FMRI
online         14:05:00 svc:/network/http:apache2
               14:05:00     7767 httpd
               14:05:01     7768 httpd
               14:05:01     7769 httpd
               14:05:01     7770 httpd
               14:05:01     7771 httpd
               14:05:01     7772 httpd

To list all available information about the service, use the -l option with the svcs.

# svcs -l apache2
fmri         svc:/network/http:apache2
name         Apache 2 HTTP server
enabled      true
state        online
next_state   none
state_time   Thu 02 Nov 2006 02:05:00 PM EST
logfile      /var/svc/log/network-http:apache2.log
restarter    svc:/system/svc/restarter:default
contract_id  174
dependency   require_all/error svc:/network/loopback:default (online)
dependency   optional_all/error svc:/network/physical:default (online)

References:

  1. Service Management Facility How To Guides
    Sun Microsystems

 

TechRabbit ad 300x250 newegg.com

Justdeals Daily Electronics Deals1x1 px

Valid HTML 4.01 Transitional

Created: Thursday November 2, 2006