Go to main content

man pages section 1: User Commands

Exit Print View

Updated: Wednesday, July 27, 2022
 
 

svcs(1)

Name

svcs - report service status

Synopsis

svcs [-aHpv?] [-o 
col[,col...]] [-R 
FMRI-instance]... 
     [-sS col]... [FMRI
 | pattern]...
svcs -d | -D [
-Hpv?] [-o col[,
col...]] [-sS col]... 
     [FMRI | pattern] ...
svcs -L [-v] [
FMRI]...
svcs -l [-v] [
FMRI | pattern]...
svcs -n [FMRI] ...
svcs -x [-v] [
-L] [FMRI]... 

Description

The svcs command displays information about service instances as recorded in the service configuration repository.

The svcs [-aHpv?] form of the command prints one-line status listings for service instances specified by the arguments. Each instance is listed only once. With no arguments, all enabled service instances, even if temporarily disabled, are listed with the columns indicated below.

The svcs -d | -D form of the command prints one-line status listings for the dependencies or dependents of the service instances specified by the arguments.

The svcs -L form of the command prints log contents. For additional information, see Options below.

The svcs -l form of the command prints detailed information about specific services and instances.

The svcs -n form of the command prints notification parameters. For additional information, see Options below.

The svcs -x form of the command explains the states of service instances. For each argument, a block of human-readable text is displayed which explains what state the service is in, and why it is in that state. With no arguments, problematic services are described.

Error messages are printed to the standard error stream.

The output of this command can be used appropriately as input to the svcadm(8) command.

Options

The following options are supported:

–?

Displays an extended usage message, including column specifiers.

–a

Show all services, including those which are disabled or incomplete. Additional information regarding incomplete services is available using svcs –x <service>.

This option has no effect if services are selected.

–d

Lists the services or service instances upon which the given service instances depend.

–D

Lists the service instances that depend on the given services or service instances.

–H

Omits the column headers.

–L

Prints the path to the logfile created by the service restarter of the selected service instances.

With –x, either print the logfile beginning after the last occurrence of log message for a method exit without errors or the last 10 lines of the logfile based on which is smaller at the end of the explanation for that service instance. If a log message for method exit without errors is present in the last line of the logfile, print the last 5 lines of the logfile.

With –v, if only a single service instance match the input, it will print the content of logfile. If multiple service instances match the input, print the last 10 lines of the logfile for each service instance.

–l

(The letter ell.) Displays all available information about the selected services and service instances, with one service attribute displayed for each line. Information for different instances are separated by blank lines.

The following specific attributes require further explanation:

dependency

Information about a dependency. The grouping and restart_on properties are displayed first and are separated by a forward slash (/). Next, each entity and its state is listed. See smf(7) for information about states. In addition to the standard states, each service dependency can have the following state descriptions:

absent

No such service is defined on the system.

invalid

The fault management resource identifier (FMRI) is invalid (see smf(7)).

multiple

The entity is a service with multiple instances.

File dependencies can only have one of the following state descriptions:

absent

No such file on the system.

online

The file exists.

If the file did not exist the last time that svc.startd evaluated the service's dependencies, it can consider the dependency to be unsatisfied. svcadm refresh forces dependency re-evaluation.

unknown

stat(2) failed for a reason other than ENOENT.

See smf(7) for additional details about dependencies, grouping, and restart_on values.

enabled

Whether the service is enabled or not, and whether it is enabled or disabled temporarily (until the next system reboot). The former is specified as either true or false, and the latter is designated by the presence of (temporary).

A service might be temporarily disabled because an administrator has run svcadm disable -t, used svcadm milestone, or booted the system to a specific milestone. See svcadm(8) for details.

–n

Prints notification parameters. See smf(7). It always prints the FMA events notification parameters and the system-wide SMF state transition notification parameters, regardless of the FMRI or pattern selected.

–o col[, col]...

Prints the specified columns. Each col should be a column name. See COLUMNS below for available columns.

–p

Lists processes associated with each service instance. A service instance can have no associated processes. The process ID, start time, and command name (PID, STIME, and CMD fields from ps(1)) are displayed for each process.

–R FMRI-instance

Selects service instances that have the given service instance as their restarter.

–s col

Sorts output by column. col should be a column name. See COLUMNS below for available columns. Multiple –s options behave additively.

–S col

Sorts by col in the opposite order as option –s.

–v

Without –x or –l, displays verbose columns: STATE, NSTATE, STIME , CTID, and FMRI.

With –x, displays extra information for each explanation.

With –l, displays user-visible properties in property groups of type application and their description.

–x

Displays explanations for service states.

Without arguments, the –x option explains the states of services which:

  • are enabled, but are not running.

  • are preventing another enabled service from running.

  • are in the degraded state.

–i

Displays date/time in the legacy non-parsable format instead of ISO 8601:22019.

Operands

The following operands are supported:

FMRI

A fault management resource identifier (FMRI) that specifies one or more instances (see smf(7)). FMRIs can be abbreviated by specifying the instance name, or the trailing portion of the service name. For example, given the FMRI:

svc:/network/smtp:sendmail

The following are valid abbreviations:

sendmail
:sendmail
smtp
smtp:sendmail
network/smtp

The following are invalid abbreviations:

mail
network
network/smt

If the FMRI specifies a service, then the command applies to all instances of that service, except when used with the –D option.

Abbreviated forms of FMRIs are unstable, and should not be used in scripts or other permanent tools.

pattern

A pattern that is matched against the FMRIs of service instances according to the globbing rules described by fnmatch(7). If the pattern does not begin with svc: and is not a glob pattern, then svc:/ is prepended. If the pattern is a glob pattern, it is used unmodified for matching.

The following is a typical example of a glob pattern:

qexample% svcs \*ssh\*
STATE          STIME               FMRI
online         2022-03-14T10:25:22 svc:/network/ssh:default

Note that changing the pattern to remove the leading glob results in different behavior:

qexample% svcs ssh\*
svcs: Pattern 'svc:/ssh:*' doesn't match any instances
STATE          STIME    FMRI
FMRI-instance

An FMRI that specifies an instance.

COLUMNS

Column names are case insensitive. The default output format is equivalent to “–o state,stime,fmri”. The default sorting columns are STATE, STIME, FMRI.

CTID

The primary contract ID for the service instance. Not all instances have valid primary contract IDs.

DESC

A brief description of the service, from its template element. A service might not have a description available, in which case a hyphen ( -) is used to denote an empty value.

FMRI

The FMRI of the service instance.

INST

The instance name of the service instance.

NSTA

The abbreviated next state of the service instance, as given in the STA column description. A hyphen denotes that the instance is not transitioning. Same as STA otherwise.

NSTATE

The next state of the service. A hyphen is used to denote that the instance is not transitioning. Same as STATE otherwise.

SCOPE

The scope name of the service instance.

SVC

The service name of the service instance.

STA

The abbreviated state of the service instance (see smf(7)):

DGD

degraded

DIS

disabled

LRC

legacy rc*.d script-initiated instance

MNT

maintenance

OFF

offline

ON

online

UN

uninitialized

Absent or unrecognized states are denoted by a question mark (?) character. An asterisk (*) is appended for instances in transition, unless the NSTA or NSTATE column is also being displayed.

See smf(7) for an explanation of service states.

STATE

The state of the service instance. An asterisk is appended for instances in transition, unless the NSTA or NSTATE column is also being displayed.

See smf(7) for an explanation of service states.

STIME

The date and time (in ISO 8601-1:2019 format) the service entered the state. The legacy, non-parsable, format is displayed when the -i option is provided or when SMF_SVCS_DATA_FMT=legacy is set in the environment.

ASTATE

The auxiliary state of the service instance, if applicable. Service instances which have no auxiliary state will display a '-' character in this column.

LRUN

The last time (in ISO 8601-1:2019 format) a periodic service instance has run. Service instances that are not periodic, and have no last execution, will display a '-' character in this column. The legacy, non-parsable, format is displayed when the -i option is provided or when SMF_SVCS_DATA_FMT=legacy is set in the environment.

See svc.periodicd(8) for an explanation of periodic services.

NRUN

The next time (in ISO 8601-1:2019 format) a periodic service instance is scheduled to run. Service instances that are not periodic do not have a next scheduled run and will display a '-' character in this column. The legacy, non-parsable, format is displayed when the -i option is provided or when SMF_SVCS_DATA_FMT=legacy is set in the environment.

See svc.periodicd(8) for an explanation of periodic services.

Examples

Example 1 Displaying the Default Output

This example displays default output:

example% svcs
STATE          STIME               FMRI
legacy_run     2022-03-14T10:25:31 lrc:/etc/rc2_d/S89PRESERVE
disabled       2022-03-14T10:25:20 svc:/system/devices/ovn-virtual-io:default
disabled       2022-03-31T11:48:16 svc:/system/name-service/cache:default
online         2022-03-14T10:25:10 svc:/system/early-manifest-import:default
online         2022-03-14T10:25:10 svc:/system/svc/restarter:default
online         2022-03-14T10:25:11 svc:/milestone/immutable-setup:default
...
Example 2 Listing All Local Instances

This example lists all local instances of the service1 service.

example% svcs -o state,nstate,fmri service1
STATE        NSTATE        FMRI
online       -             svc:/service1:instance1
disabled     -             svc:/service1:instance2
Example 3 Listing Verbose Information

This example lists verbose information.

example% svcs -v network/rpc/bind
STATE          NSTATE        STIME               CTID      FMRI
online         -             2022-03-14T10:25:25       128 svc:/network/rpc/bind:default
Example 4 Listing Detailed Information

This example lists detailed information about all instances of system/rad. Additional fields can be displayed, as appropriate to the managing restarter.

example% svcs -l system/rad
fmri         svc:/system/rad:local
name         Remote Administration Daemon
enabled      true
state        online
next_state   none
state_time   2022-03-18T11:59:06
logfile      /var/svc/log/system-rad:local.log
restarter    svc:/system/svc/restarter:default
contract_id  2006
manifest     /lib/svc/manifest/system/rad.xml
dependency   require_all/none svc:/system/filesystem/minimal:default (online)

fmri         svc:/system/rad:remote
name         Remote Administration Daemon
enabled      true
state        online
next_state   none
state_time   2022-04-13T12:31:57
logfile      /var/svc/log/system-rad:remote.log
restarter    svc:/system/svc/restarter:default
contract_id  12333
manifest     /lib/svc/manifest/system/rad.xml
dependency   require_all/refresh svc:/system/identity:cert (online)
dependency   require_all/none svc:/milestone/multi-user (online)
dependency   require_all/none svc:/system/filesystem/minimal:default (online)
Example 5 Listing Processes
example% svcs -p sendmail
STATE          STIME               FMRI
online         2022-03-14T10:25:26 svc:/network/smtp:sendmail
               2022-03-14T10:25:46      1489 sendmail
Example 6 Explaining Service States Using svcs –x

(a) In this example, svcs –x has identified that the identity:cert service being in maintenance is the root cause of two services which are enabled but not online. svcs –xv shows that those services are system/rad:remote and system/webui. This situation can be rectified by either clearing identity:cert or disabling system/rad:remote and system/webui.

example%
svc:/system/identity:cert (System identity (X.509 certificate))
 State: maintenance since 2022-04-13T12:18:35
Reason: Maintenance requested by an administrator.
   See: http://support.oracle.com/msg/SMF-8000-63
   See: identity(7)
   See: /var/svc/log/system-identity:cert.log
Impact: 2 dependent services are not running.  (Use -v for list.)
			
example%
svc:/system/identity:cert (System identity (X.509 certificate))
 State: maintenance since 2022-04-13T12:18:35
Reason: Maintenance requested by an administrator.
   See: http://support.oracle.com/msg/SMF-8000-63
   See: man -M /usr/share/man -s 7 identity
   See: /var/svc/log/system-identity:cert.log
Impact: 2 dependent services are not running:
        svc:/system/rad:remote
        svc:/system/webui/server:default
			

(b) In this example, NFS is not working:

example$ svcs nfs/client
STATE          STIME               FMRI
offline       2022-03-14T10:25:12 svc:/network/nfs/client:default

(c) The following example shows that the problem is nfs/status. nfs/client is waiting because it depends on nfs/nlockmgr, which depends on nfs/status:

example$ svcs -xv nfs/client
svc:/network/nfs/client:default (NFS client)
 State: offline since 2022-03-14T10:25:12
Reason: Service svc:/network/nfs/status:default
        is not running because a method failed repeatedly.
   See: http://support.oracle.com/msg/SMF-8000-GE
  Path: svc:/network/nfs/client:default
          svc:/network/nfs/nlockmgr:default
            svc:/network/nfs/status:default
   See: man -M /usr/share/man -s 8 mount_nfs
   See: /var/svc/log/network-nfs-client:default.log
Impact: This service is not running.

Environment Variables

SMF_SVCS_DATE_FMT

When set to legacy the legacy, non-parsable, date/time format is used instead of ISO 8601-1:2019. For the legacy format if the date/time is with the last 24 hours only the time is displayed, otherwise the month and day with underscores (_) in place of blanks is displayed. The value of iso8601 can be set to explicitly request ISO 8601-1:2019 format, though this is the default if the variable is not set.

Exit Status

The following exit values are returned:

0

Successful command invocation.

1

Fatal error.

2

Invalid command line options were specified.

Attributes

See attributes(7) for descriptions of the following attributes:

ATTRIBUTE TYPE
ATTRIBUTE VALUE
Availability
system/core-os
Interface Stability
See below.

Screen output is Uncommitted. The invocation is Committed.

See Also

ps(1), svcprop(1), stat(2), libscf(3LIB), attributes(7), fnmatch(7), smf(7), svc.periodicd(8), svc.startd(8), svcadm(8), svccfg(8)

History

Support for the –i option and variable SMF_SVCS_DATE_FMT, was added in the Oracle Solaris 11.4.48 release.

The svcs command was added in Solaris 10.