1svcadm(1M)              System Administration Commands              svcadm(1M)
2
3
4

NAME

6       svcadm - manipulate service instances
7

SYNOPSIS

9       /usr/sbin/svcadm [-v] enable [-rst] {FMRI | pattern}...
10
11
12       /usr/sbin/svcadm [-v] disable [-st] {FMRI | pattern}...
13
14
15       /usr/sbin/svcadm [-v] restart {FMRI | pattern}...
16
17
18       /usr/sbin/svcadm [-v] refresh {FMRI | pattern}...
19
20
21       /usr/sbin/svcadm [-v] clear {FMRI | pattern}...
22
23
24       /usr/sbin/svcadm [-v] mark [-It] instance_state
25            {FMRI | pattern}...
26
27
28       /usr/sbin/svcadm [-v] milestone [-d] milestone_FMRI
29
30

DESCRIPTION

32       svcadm  issues  requests  for  actions on services executing within the
33       service management facility (see smf(5)). Actions  for  a  service  are
34       carried  out  by its assigned service restarter agent. The default ser‐
35       vice restarter is svc.startd (see svc.startd(1M)).
36

OPTIONS

38       The following options are supported:
39
40       -v    Print actions verbosely to standard output.
41
42

SUBCOMMANDS

44   Common Operations
45       The subcommands listed below are used during the typical administration
46       of a service instance.
47
48
49       For subcommands taking one or more operands, if the operand specifies a
50       service (instead of a service instance), and that service  has  only  a
51       single  instance,  svcadm  operates on that instance. If an abbreviated
52       FMRI (a fault management resource identifier) or pattern  matches  more
53       than  one  service,  a warning message is displayed and that operand is
54       ignored. See smf(5).
55
56
57       In the case that the service has more than one instance, svcadm  return
58       a non-zero exit status.
59
60       enable [-rst] {FMRI | pattern}. . .
61
62           Enables  the  service instances specified by the operands. For each
63           service instance, the assigned restarter will try to  bring  it  to
64           the  online  state.  This  action requires permission to modify the
65           "general" property group of the  service  instance  (see  smf_secu‐
66           rity(5)).
67
68           If the -r option is specified, svcadm enables each service instance
69           and recursively enables its dependencies.
70
71           If the -s option is specified, svcadm enables each service instance
72           and  then  waits  for  each service instance to enter the online or
73           degraded state. svcadm will return early if it determines that  the
74           service  cannot  reach these states without administrator interven‐
75           tion.
76
77           If the -t option is specified, svcadm temporarily enables each ser‐
78           vice  instance.  Temporary  enable  only  lasts  until reboot. This
79           action requires permission to modify the "restarter_actions"  prop‐
80           erty  group  of  the  service  instance  (see  smf_security(5)). By
81           default, enable is persistent across reboot.
82
83
84       disable [-st] {FMRI | pattern}. . .
85
86           Disables the service instance specified by the operands.  For  each
87           service  instance,  the  assigned restarter will try to bring it to
88           the disabled state. This action requires permission to  modify  the
89           "general"  property  group  of  the service instance (see smf_secu‐
90           rity(5)).
91
92           If the  -s  option  is  specified,  svcadm  disables  each  service
93           instance and then waits for each service instance to enter the dis‐
94           abled state. svcadm will return early if  it  determines  that  the
95           service cannot reach this state without administrator intervention.
96
97           If  the  -t  option  is specified, svcadm temporarily disables each
98           service instance. Temporary disable only lasts until  reboot.  This
99           action  requires permission to modify the "restarter_actions" prop‐
100           erty group  of  the  service  instance  (see  smf_security(5)).  By
101           default, disable is persistent across reboot.
102
103
104       restart {FMRI | pattern}. . .
105
106           Requests  that  the  service instances specified by the operands be
107           restarted.  This  action  requires   permission   to   modify   the
108           "restarter_actions"  property  group  of  the service instance (see
109           smf_security(5)).
110
111           This subcommand can restart only those services  that  are  in  the
112           online or degraded states, as those states are defined in smf(5).
113
114
115       refresh {FMRI | pattern}. . .
116
117           For  each service instance specified by the operands, requests that
118           the assigned restarter update the service's  running  configuration
119           snapshot  with  the  values from the current configuration. Some of
120           these values  take  effect  immediately  (for  example,  dependency
121           changes).  Other  values  do not take effect until the next service
122           restart. See the  restarter  and  service  documentation  for  more
123           information.
124
125           If  the  service  is  managed by svc.startd(1M), the refresh method
126           will be invoked if it exists to request the service reread its  own
127           configuration.  For  other restarters, see the restarter documenta‐
128           tion.
129
130           This action requires permission to modify  the  "restarter_actions"
131           property group of the service instance (see smf_security(5)).
132
133
134       clear {FMRI | pattern}. . .
135
136           For  each  service  instance  specified  by  the  operands,  if the
137           instance is in  the  maintenance  state,  signal  to  the  assigned
138           restarter that the service has been repaired. If the instance is in
139           the degraded state, request that the assigned  restarter  take  the
140           service  to  the  online  state. This action requires permission to
141           modify  the  "restarter_actions"  property  group  of  the  service
142           instance (see smf_security(5)).
143
144
145   Exceptional Operations
146       The  following  subcommands are used for service development and tempo‐
147       rary administrative manipulation.
148
149       mark [-It] instance_state {FMRI | pattern}. . .
150
151           If instance_state is "maintenance", then for each service specified
152           by  the operands, svcadm requests that the assigned restarter place
153           the service  in  the  maintenance  state.  See  svc.startd(1M)  and
154           inetd(1M)  for a detailed description of the actions taken for each
155           restarter.
156
157           If instance_state is "degraded", then for services specified by the
158           operands  in  the online state, svcadm requests that the restarters
159           assigned to the services move them into the degraded state.
160
161           If the -I option is specified, the request is flagged as immediate.
162
163           The -t option is only valid for  maintenance  requests.  When  this
164           option  is  specified, the request is flagged as temporary, and its
165           effect will only last until the next reboot.
166
167
168       milestone [-d] milestone_FMRI
169
170           If milestone_FMRI is the keyword "none", all  services  other  than
171           the  master  restarter,  svc:/system/svc/restarter:default, will be
172           temporarily disabled.
173
174           If milestone_FMRI is the keyword "all", temporary enable  and  dis‐
175           able requests for all services will be nullified.
176
177           If milestone_FMRI is one of the following:
178
179             svc:/milestone/single-user:default
180             svc:/milestone/multi-user:default
181             svc:/milestone/multi-user-server:default
182
183
184           then  temporary  enable and disable requests for the indicated ser‐
185           vice and all services it depends on (directly or  indirectly)  will
186           be nullified. All other services will be temporarily disabled.
187
188           Changing  the  system's current milestone with the "milestone" sub‐
189           command will not change the current run level  of  the  system.  To
190           change the system's run level, invoke /sbin/init directly.
191
192           This  action  requires permission to modify the "options_ovr" prop‐
193           erty  group  of   the   svc:/system/svc/restarter:default   service
194           instance (see smf_security(5)).
195
196           The  -d  option  immediately changes the milestone to the requested
197           milestone, as above. Additionally, it makes the specified milestone
198           the  default  boot  milestone,  which  persists  across reboot. The
199           default milestone is defined by the options/milestone  property  on
200           the  master  restarter,  svc:/system/svc/restarter:default. If this
201           property is absent, "all" is the default. This action requires per‐
202           mission  to  modify  the  "options" property group of the svc:/sys‐
203           tem/svc/restarter:default service instance (see smf_security(5)).
204
205
206   Operands
207       The following operands are supported:
208
209       FMRI       An FMRI that specifies one or more instances. FMRIs  can  be
210                  abbreviated by specifying the instance name, or the trailing
211                  portion of the service name. For example, given the FMRI:
212
213                    svc:/network/smtp:sendmail
214
215
216                  All the following are valid abbreviations:
217
218                    sendmail
219                    :sendmail
220                    smtp
221                    smtp:sendmail
222                    network/smtp
223
224
225                  While the following are invalid:
226
227                    mail
228                    network
229                    network/smt
230
231
232                  If the FMRI specifies a service, then the command applies to
233                  all  instances  of  that service. Abbreviated forms of FMRIs
234                  are unstable, and should not be used  in  scripts  or  other
235                  permanent tools.
236
237
238       pattern    A  pattern  that  is  matched  against  the FMRIs of service
239                  instances according to the  "globbing"  rules  described  by
240                  fnmatch(5).  If the pattern does not begin with "svc:", then
241                  "svc:/" is prepended.
242
243
244
245       If an abbreviated FMRI or pattern matches  more  than  one  service,  a
246       warning message is displayed and that operand is ignored.
247

EXAMPLES

249       Example 1 Restarting a Service Instance
250
251
252       The  following  command  restarts the NFS server. The full FMRI for the
253       default service instance is: svc:/network/nfs/server:default
254
255
256
257       However, you can abbreviate the full FMRI as follows:
258
259
260         # svcadm restart nfs/server
261
262
263
264       Example 2 Disabling the Standard HTTP Server
265
266
267       The following command disables  the  standard  HTTP  server,  using  an
268       abbreviated FMRI:
269
270
271         $ svcadm disable http
272
273
274
275       Example 3 Enabling an Instance and Its Dependent Instances
276
277
278       The  following  command enables the foo:bar instance, and all instances
279       on which it depends:
280
281
282         $ svcadm enable -r foo:bar
283
284
285
286       Example 4 Synchronously enabling an instance
287
288
289       The following command enables the foo:bar instance.  The  command  will
290       not  return  until the instance comes online or svcadm determines it is
291       not possible for the service to come online.
292
293
294         $ svcadm enable -s foo:bar
295
296
297
298       Example 5 Restricting and Restoring the Running Services
299
300
301       The following command restricts the running  services  to  single  user
302       mode:
303
304
305         # svcadm milestone milestone/single-user
306
307
308
309
310       The following command restores the running services:
311
312
313         # svcadm milestone all
314
315
316

EXIT STATUS

318       The following exit values are returned:
319
320       0    Successful completion.
321
322
323       1    A  fatal  error occurred. One or more error messages are displayed
324            on standard error.
325
326
327       2    Invalid command line options were specified.
328
329
330       3    svcadm determined that a service instance that it was waiting  for
331            could  not reach the desired state without administrator interven‐
332            tion due to a problem with the service instance itself.
333
334
335       4    svcadm determined that a service instance that it was waiting  for
336            could  not reach the desired state without administrator interven‐
337            tion due to a problem with the service's dependencies.
338
339

ATTRIBUTES

341       See attributes(5) for descriptions of the following attributes:
342
343
344
345
346       ┌─────────────────────────────┬─────────────────────────────┐
347       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
348       ├─────────────────────────────┼─────────────────────────────┤
349       │Availability                 │SUNWcsu                      │
350       ├─────────────────────────────┼─────────────────────────────┤
351       │Interface Stability          │See below.                   │
352       └─────────────────────────────┴─────────────────────────────┘
353
354
355       The interactive output is Uncommitted. The invocation and  non-interac‐
356       tive output are Committed.
357

SEE ALSO

359       svcprop(1),  svcs(1),  inetd(1M), init(1M), svccfg(1M), svc.startd(1M),
360       libscf(3LIB), contract(4), attributes(5), smf(5), smf_security(5)
361

NOTES

363       The amount of time svcadm will spend waiting  for  services  and  their
364       dependencies  to  change  state  is  implicitly limited by their method
365       timeouts. For example, a service  using  the  default  restarter  whose
366       start  method  hangs will be transitioned to the maintenance state when
367       its timeout expires. svcadm will then consider it impossible  for  this
368       service to come online without administrator intervention.
369
370
371       Attempts  to  synchronously enable a service which depends (directly or
372       indirectly) on a file may fail with  an  exit  status  indicating  that
373       dependencies are unsatisfied if the caller does not have the privileges
374       necessary to search the directory containing the file. This  limitation
375       may be removed in a future Solaris release.
376
377
378
379SunOS 5.11                        9 May 2008                        svcadm(1M)
Impressum