summaryrefslogtreecommitdiff
path: root/usr/src/man/man1m/svcadm.1m
blob: 550e093239f4f925000eb7d97ec5a6b60286648e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
'\" te
.\" Copyright (c) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" Copyright 2020 Joyent, Inc.
.\" 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 "May 11, 2020"
.SH NAME
svcadm \- manipulate service instances
.SH SYNOPSIS
.nf
\fB/usr/sbin/svcadm\fR [\fB-S state\fR] [\fB-v\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] enable [\fB-rst\fR]
     [{\fIFMRI\fR | \fIpattern\fR}...]
.fi

.LP
.nf
\fB/usr/sbin/svcadm\fR [\fB-S state\fR] [\fB-v\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] disable
     [\fB-c\fR \fIcomment\fR] [\fB-st\fR] [{\fIFMRI\fR | \fIpattern\fR}...]
.fi

.LP
.nf
\fB/usr/sbin/svcadm\fR [\fB-S state\fR] [\fB-v\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] restart [\fB-d\fR]
     [{\fIFMRI\fR | \fIpattern\fR}...]
.fi

.LP
.nf
\fB/usr/sbin/svcadm\fR [\fB-S state\fR] [\fB-v\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] refresh
     [{\fIFMRI\fR | \fIpattern\fR}...]
.fi

.LP
.nf
\fB/usr/sbin/svcadm\fR [\fB-S state\fR] [\fB-v\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] clear
     [{\fIFMRI\fR | \fIpattern\fR}...]
.fi

.LP
.nf
\fB/usr/sbin/svcadm\fR [\fB-S state\fR] [\fB-v\fR] [\fB-Z\fR | \fB-z\fR \fIzone\fR] mark [\fB-It] \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
\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
The following options are supported:
.sp
.ne 2
.na
\fB-S\fR \fIstate\fR
.ad
.RS 20n
For the subcommands which normally operate on explicit \fIFMRI\fRs or an
\fIFMRI\fR pattern, the \fB-S\fR option can be used to select all \fIFMRI\fRs
in the given state.
.RE

.sp
.ne 2
.na
\fB\fB-v\fR\fR
.ad
.RS 20n
Print actions verbosely to standard output.
.RE

.sp
.ne 2
.na
\fB-Z\fR
.ad
.RS 20n
Administer services in all zones.  This option is only applicable
from the global zone, see \fBzones\fR(5).
.RE

.sp
.ne 2
.na
\fB-z\fR \fIzone\fR
.ad
.RS 20n
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"
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) matches more than one service or instance, a
warning message is displayed and that operand is ignored.
If a pattern matches more than one service or instance, the subcommand is
applied to all matches. 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
.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
.na
\fB\fBdisable\fR [\fB-c\fR \fIcomment\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.
.sp
If the \fB-c\fR option is specified, the given free-form comment is recorded
in the (temporary) service configuration under the \fBgeneral/comment\fR
property.  This can serve as an administrator reason for disabling the service,
and is reported by \fBsvcs\fR(1).
.RE

.sp
.ne 2
.na
\fB\fBrestart\fR [\fB-d\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).
.sp
If the \fB-d\fR option is specified, the restarter sends a \fBSIGABRT\fR to all
members of the contract, which should cause a core dump, before restarting
the service.
.RE

.sp
.ne 2
.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
.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"
The following subcommands are used for service development and temporary
administrative manipulation.
.sp
.ne 2
.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
.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"
The following operands are supported:
.sp
.ne 2
.na
\fB\fIFMRI\fR\fR
.ad
.RS 11n
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
.na
\fB\fIpattern\fR\fR
.ad
.RS 11n
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 matches more than one service, a warning message
is displayed and that operand is ignored.
If a pattern matches more than one service or instance, the subcommand is
applied to all matches.
.SH EXAMPLES
\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 a service
.sp
.LP
The following command synchronously disables a service, using an abbreviated
\fIFMRI\fR, and recording a ticket ID as the administrative reason:

.sp
.in +2
.nf
$ svcadm disable -c "OPS-1000" -s 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
The following exit values are returned:
.sp
.ne 2
.na
\fB\fB0\fR\fR
.ad
.RS 5n
Successful completion.
.RE

.sp
.ne 2
.na
\fB\fB1\fR\fR
.ad
.RS 5n
A fatal error occurred. One or more error messages are displayed on standard
error.
.RE

.sp
.ne 2
.na
\fB\fB2\fR\fR
.ad
.RS 5n
Invalid command line options were specified.
.RE

.sp
.ne 2
.na
\fB\fB3\fR\fR
.ad
.RS 5n
\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
.na
\fB\fB4\fR\fR
.ad
.RS 5n
\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
See \fBattributes\fR(5) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	See below.
.TE

.sp
.LP
The interactive output is Uncommitted. The invocation and non-interactive
output are Committed.
.SH SEE ALSO
\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
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
release.