'\" te .\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved. .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License. .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License. .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner] .TH svcadm 1M "9 May 2008" "SunOS 5.11" "System Administration Commands" .SH NAME svcadm \- manipulate service instances .SH SYNOPSIS .LP .nf \fB/usr/sbin/svcadm\fR [\fB-v\fR] [\fB-z\fR \fIzone\fR] enable [\fB-rst\fR] {\fIFMRI\fR | \fIpattern\fR}... .fi .LP .nf \fB/usr/sbin/svcadm\fR [\fB-v\fR] [\fB-z\fR \fIzone\fR] disable [\fB-st\fR] {\fIFMRI\fR | \fIpattern\fR}... .fi .LP .nf \fB/usr/sbin/svcadm\fR [\fB-v\fR] [\fB-z\fR \fIzone\fR] restart {\fIFMRI\fR | \fIpattern\fR}... .fi .LP .nf \fB/usr/sbin/svcadm\fR [\fB-v\fR] [\fB-z\fR \fIzone\fR] refresh {\fIFMRI\fR | \fIpattern\fR}... .fi .LP .nf \fB/usr/sbin/svcadm\fR [\fB-v\fR] [\fB-z\fR \fIzone\fR] clear {\fIFMRI\fR | \fIpattern\fR}... .fi .LP .nf \fB/usr/sbin/svcadm\fR [\fB-v\fR] [\fB-z\fR \fIzone\fR] mark [\fB-It\fR] \fIinstance_state\fR {\fIFMRI\fR | \fIpattern\fR}... .fi .LP .nf \fB/usr/sbin/svcadm\fR [\fB-v\fR] milestone [\fB-d\fR] \fImilestone_FMRI\fR .fi .SH DESCRIPTION .sp .LP \fBsvcadm\fR issues requests for actions on services executing within the service management facility (see \fBsmf\fR(5)). Actions for a service are carried out by its assigned service restarter agent. The default service restarter is \fBsvc.startd\fR (see \fBsvc.startd\fR(1M)). .SH OPTIONS .sp .LP The following options are supported: .sp .ne 2 .mk .na \fB\fB-v\fR\fR .ad .RS 20n .rt Print actions verbosely to standard output. .RE .sp .ne 2 .mk .na \fB-z\fR \fIzone\fR .ad .RS 20n .rt Administer services in the specified zone. This option is only applicable from the global zone, see \fBzones\fR(5). .RE .SH SUBCOMMANDS .SS "Common Operations" .sp .LP The subcommands listed below are used during the typical administration of a service instance. .sp .LP For subcommands taking one or more operands, if the operand specifies a service (instead of a service instance), and that service has only a single instance, \fBsvcadm\fR operates on that instance. If an abbreviated \fIFMRI\fR (a fault management resource identifier) or pattern matches more than one service, a warning message is displayed and that operand is ignored. See \fBsmf\fR(5). .sp .LP In the case that the service has more than one instance, \fBsvcadm\fR return a non-zero exit status. .sp .ne 2 .mk .na \fB\fBenable\fR \fB[\fR\fB-rst\fR\fB]\fR {\fIFMRI\fR | \fIpattern\fR}. . .\fR .ad .sp .6 .RS 4n Enables the service instances specified by the operands. For each service instance, the assigned restarter will try to bring it to the online state. This action requires permission to modify the "general" property group of the service instance (see \fBsmf_security\fR(5)). .sp If the \fB-r\fR option is specified, \fBsvcadm\fR enables each service instance and recursively enables its dependencies. .sp If the \fB-s\fR option is specified, \fBsvcadm\fR enables each service instance and then waits for each service instance to enter the \fBonline\fR or \fBdegraded\fR state. \fBsvcadm\fR will return early if it determines that the service cannot reach these states without administrator intervention. .sp If the \fB-t\fR option is specified, \fBsvcadm\fR temporarily enables each service instance. Temporary enable only lasts until reboot. This action requires permission to modify the "restarter_actions" property group of the service instance (see \fBsmf_security\fR(5)). By default, \fBenable\fR is persistent across reboot. .RE .sp .ne 2 .mk .na \fB\fBdisable\fR [\fB-st\fR] {\fIFMRI\fR | \fIpattern\fR}. . .\fR .ad .sp .6 .RS 4n Disables the service instance specified by the operands. For each service instance, the assigned restarter will try to bring it to the disabled state. This action requires permission to modify the "general" property group of the service instance (see \fBsmf_security\fR(5)). .sp If the \fB-s\fR option is specified, \fBsvcadm\fR disables each service instance and then waits for each service instance to enter the disabled state. \fBsvcadm\fR will return early if it determines that the service cannot reach this state without administrator intervention. .sp If the \fB-t\fR option is specified, \fBsvcadm\fR temporarily disables each service instance. Temporary disable only lasts until reboot. This action requires permission to modify the "restarter_actions" property group of the service instance (see \fBsmf_security\fR(5)). By default, \fBdisable\fR is persistent across reboot. .RE .sp .ne 2 .mk .na \fB\fBrestart\fR {\fIFMRI\fR | \fIpattern\fR}. . .\fR .ad .sp .6 .RS 4n Requests that the service instances specified by the operands be restarted. This action requires permission to modify the "restarter_actions" property group of the service instance (see \fBsmf_security\fR(5)). .sp This subcommand can restart only those services that are in the online or degraded states, as those states are defined in \fBsmf\fR(5). .RE .sp .ne 2 .mk .na \fB\fBrefresh\fR {\fIFMRI\fR | \fIpattern\fR}. . .\fR .ad .sp .6 .RS 4n For each service instance specified by the operands, requests that the assigned restarter update the service's running configuration snapshot with the values from the current configuration. Some of these values take effect immediately (for example, dependency changes). Other values do not take effect until the next service \fBrestart\fR. See the restarter and service documentation for more information. .sp If the service is managed by \fBsvc.startd\fR(1M), the \fBrefresh\fR method will be invoked if it exists to request the service reread its own configuration. For other restarters, see the restarter documentation. .sp This action requires permission to modify the "restarter_actions" property group of the service instance (see \fBsmf_security\fR(5)). .RE .sp .ne 2 .mk .na \fB\fBclear\fR {\fIFMRI\fR | \fIpattern\fR}. . .\fR .ad .sp .6 .RS 4n For each service instance specified by the operands, if the instance is in the \fBmaintenance\fR state, signal to the assigned restarter that the service has been repaired. If the instance is in the \fBdegraded\fR state, request that the assigned restarter take the service to the \fBonline\fR state. This action requires permission to modify the "restarter_actions" property group of the service instance (see \fBsmf_security\fR(5)). .RE .SS "Exceptional Operations" .sp .LP The following subcommands are used for service development and temporary administrative manipulation. .sp .ne 2 .mk .na \fB\fBmark [\fR\fB-It\fR\fB]\fR \fIinstance_state\fR {\fIFMRI\fR | \fIpattern\fR}. . .\fR .ad .sp .6 .RS 4n If \fIinstance_state\fR is "maintenance", then for each service specified by the operands, \fBsvcadm\fR requests that the assigned restarter place the service in the \fBmaintenance\fR state. See \fBsvc.startd\fR(1M) and \fBinetd\fR(1M) for a detailed description of the actions taken for each restarter. .sp If \fIinstance_state\fR is "degraded", then for services specified by the operands in the online state, \fBsvcadm\fR requests that the restarters assigned to the services move them into the \fBdegraded\fR state. .sp If the \fB-I\fR option is specified, the request is flagged as immediate. .sp The \fB-t\fR option is only valid for maintenance requests. When this option is specified, the request is flagged as temporary, and its effect will only last until the next reboot. .RE .sp .ne 2 .mk .na \fB\fBmilestone\fR [\fB-d\fR] \fImilestone_FMRI\fR\fR .ad .sp .6 .RS 4n If \fImilestone_FMRI\fR is the keyword "none", all services other than the master restarter, \fBsvc:/system/svc/restarter:default\fR, will be temporarily disabled. .sp If \fImilestone_FMRI\fR is the keyword "all", temporary enable and disable requests for all services will be nullified. .sp If \fImilestone_FMRI\fR is one of the following: .sp .in +2 .nf svc:/milestone/single-user:default svc:/milestone/multi-user:default svc:/milestone/multi-user-server:default .fi .in -2 .sp then temporary enable and disable requests for the indicated service and all services it depends on (directly or indirectly) will be nullified. All other services will be temporarily disabled. .sp Changing the system's current milestone with the "milestone" subcommand will not change the current run level of the system. To change the system's run level, invoke \fB/sbin/init\fR directly. .sp This action requires permission to modify the "options_ovr" property group of the \fBsvc:/system/svc/restarter:default\fR service instance (see \fBsmf_security\fR(5)). .sp The \fB-d\fR option immediately changes the milestone to the requested milestone, as above. Additionally, it makes the specified milestone the default boot milestone, which persists across reboot. The default milestone is defined by the \fBoptions/milestone\fR property on the master restarter, \fBsvc:/system/svc/restarter:default\fR. If this property is absent, "all" is the default. This action requires permission to modify the "options" property group of the \fBsvc:/system/svc/restarter:default\fR service instance (see \fBsmf_security\fR(5)). .RE .SS "Operands" .sp .LP The following operands are supported: .sp .ne 2 .mk .na \fB\fIFMRI\fR\fR .ad .RS 11n .rt An \fIFMRI\fR that specifies one or more instances. \fIFMRI\fRs can be abbreviated by specifying the instance name, or the trailing portion of the service name. For example, given the \fIFMRI\fR: .sp .in +2 .nf svc:/network/smtp:sendmail .fi .in -2 .sp All the following are valid abbreviations: .sp .in +2 .nf sendmail :sendmail smtp smtp:sendmail network/smtp .fi .in -2 .sp While the following are invalid: .sp .in +2 .nf mail network network/smt .fi .in -2 .sp If the \fIFMRI\fR specifies a service, then the command applies to all instances of that service. Abbreviated forms of \fIFMRI\fRs are unstable, and should not be used in scripts or other permanent tools. .RE .sp .ne 2 .mk .na \fB\fIpattern\fR\fR .ad .RS 11n .rt A pattern that is matched against the \fIFMRIs\fR of service instances according to the "globbing" rules described by \fBfnmatch\fR(5). If the pattern does not begin with "svc:", then "svc:/" is prepended. .RE .sp .LP If an abbreviated \fIFMRI\fR or pattern matches more than one service, a warning message is displayed and that operand is ignored. .SH EXAMPLES .LP \fBExample 1 \fRRestarting a Service Instance .sp .LP The following command restarts the \fBNFS\fR server. The full \fIFMRI\fR for the default service instance is: \fBsvc:/network/nfs/server:default\fR .sp .LP However, you can abbreviate the full \fIFMRI\fR as follows: .sp .in +2 .nf # svcadm restart nfs/server .fi .in -2 .sp .LP \fBExample 2 \fRDisabling the Standard HTTP Server .sp .LP The following command disables the standard HTTP server, using an abbreviated \fIFMRI\fR: .sp .in +2 .nf $ svcadm disable http .fi .in -2 .sp .LP \fBExample 3 \fREnabling an Instance and Its Dependent Instances .sp .LP The following command enables the \fBfoo:bar\fR instance, and all instances on which it depends: .sp .in +2 .nf $ svcadm enable -r foo:bar .fi .in -2 .sp .LP \fBExample 4 \fRSynchronously enabling an instance .sp .LP The following command enables the \fBfoo:bar\fR instance. The command will not return until the instance comes online or \fBsvcadm\fR determines it is not possible for the service to come online. .sp .in +2 .nf $ svcadm enable -s foo:bar .fi .in -2 .sp .LP \fBExample 5 \fRRestricting and Restoring the Running Services .sp .LP The following command restricts the running services to single user mode: .sp .in +2 .nf # svcadm milestone milestone/single-user .fi .in -2 .sp .sp .LP The following command restores the running services: .sp .in +2 .nf # svcadm milestone all .fi .in -2 .sp .SH EXIT STATUS .sp .LP The following exit values are returned: .sp .ne 2 .mk .na \fB\fB0\fR\fR .ad .RS 5n .rt Successful completion. .RE .sp .ne 2 .mk .na \fB\fB1\fR\fR .ad .RS 5n .rt A fatal error occurred. One or more error messages are displayed on standard error. .RE .sp .ne 2 .mk .na \fB\fB2\fR\fR .ad .RS 5n .rt Invalid command line options were specified. .RE .sp .ne 2 .mk .na \fB\fB3\fR\fR .ad .RS 5n .rt \fBsvcadm\fR determined that a service instance that it was waiting for could not reach the desired state without administrator intervention due to a problem with the service instance itself. .RE .sp .ne 2 .mk .na \fB\fB4\fR\fR .ad .RS 5n .rt \fBsvcadm\fR determined that a service instance that it was waiting for could not reach the desired state without administrator intervention due to a problem with the service's dependencies. .RE .SH ATTRIBUTES .sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp .sp .TS tab() box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) . ATTRIBUTE TYPEATTRIBUTE VALUE _ Interface StabilitySee below. .TE .sp .LP The interactive output is Uncommitted. The invocation and non-interactive output are Committed. .SH SEE ALSO .sp .LP \fBsvcprop\fR(1), \fBsvcs\fR(1), \fBinetd\fR(1M), \fBinit\fR(1M), \fBsvccfg\fR(1M), \fBsvc.startd\fR(1M), \fBlibscf\fR(3LIB), \fBcontract\fR(4), \fBattributes\fR(5), \fBsmf\fR(5), \fBsmf_security\fR(5), \fBzones\fR(5) .SH NOTES .sp .LP The amount of time \fBsvcadm\fR will spend waiting for services and their dependencies to change state is implicitly limited by their method timeouts. For example, a service using the default restarter whose start method hangs will be transitioned to the maintenance state when its timeout expires. \fBsvcadm\fR will then consider it impossible for this service to come online without administrator intervention. .sp .LP Attempts to synchronously enable a service which depends (directly or indirectly) on a file may fail with an exit status indicating that dependencies are unsatisfied if the caller does not have the privileges necessary to search the directory containing the file. This limitation may be removed in a future Solaris release.