]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - usr.sbin/service/service.8
MFV r331695, 331700: 9166 zfs storage pool checkpoint
[FreeBSD/FreeBSD.git] / usr.sbin / service / service.8
1 .\" Copyright (c) 2009 Douglas Barton
2 .\" All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\"
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23 .\" SUCH DAMAGE.
24 .\"
25 .\" $FreeBSD$
26 .\"
27 .Dd January 15, 2018
28 .Dt SERVICE 8
29 .Os
30 .Sh NAME
31 .Nm service
32 .Nd "control (start/stop/etc.) or list system services"
33 .Sh SYNOPSIS
34 .Nm
35 .Op Fl j Ao jail name or id Ac
36 .Fl e
37 .Nm
38 .Op Fl j Ao jail name or id Ac
39 .Fl R
40 .Nm
41 .Op Fl j Ao jail name or id Ac
42 .Op Fl v
43 .Fl l | r
44 .Nm
45 .Op Fl j Ao jail name or id Ac
46 .Op Fl v
47 .Ar <rc.d script> start|stop|etc.
48 .Sh DESCRIPTION
49 The
50 .Nm
51 command is an easy interface to the rc.d system.
52 Its primary purpose is to start and stop services provided
53 by the rc.d scripts.
54 When used for this purpose it will set the same restricted
55 environment that is in use at boot time (see below).
56 It can also be used to list
57 the scripts using various criteria.
58 .Pp
59 The options are as follows:
60 .Bl -tag -width F1
61 .It Fl j Ao jail name or id Ac
62 Perform the given actions under the named jail.
63 .It Fl e
64 List services that are enabled.
65 The list of scripts to check is compiled using
66 .Xr rcorder 8
67 the same way that it is done in
68 .Xr rc 8 ,
69 then that list of scripts is checked for an
70 .Qq rcvar
71 assignment.
72 If present the script is checked to see if it is enabled.
73 .It Fl R
74 Restart all enabled local services.
75 .It Fl l
76 List all files in
77 .Pa /etc/rc.d
78 and the local startup directories.
79 As described in
80 .Xr rc.conf 5
81 this is usually
82 .Pa /usr/local/etc/rc.d .
83 All files will be listed whether they are an actual
84 rc.d script or not.
85 .It Fl r
86 Generate the
87 .Xr rcorder 8
88 as in
89 .Fl e
90 above, but list all of the files, not just what is enabled.
91 .It Fl v
92 Be slightly more verbose
93 .El
94 .Sh ENVIRONMENT
95 When used to run rc.d scripts the
96 .Nm
97 command sets
98 .Ev HOME
99 to
100 .Pa /
101 and
102 .Ev PATH
103 to
104 .Pa /sbin:/bin:/usr/sbin:/usr/bin
105 which is how they are set in
106 .Pa /etc/rc
107 at boot time.
108 .Sh EXIT STATUS
109 .Ex -std
110 .Sh EXAMPLES
111 The following are examples of typical usage of the
112 .Nm
113 command:
114 .Pp
115 .Dl "service named status"
116 .Dl "service -j dns named status"
117 .Dl "service -rv"
118 .Pp
119 The following programmable completion entry can be use in
120 .Xr bash 1
121 for the names of the rc.d scripts:
122 .Dl "_service () {"
123 .Dl "   local cur"
124 .Dl "   cur=${COMP_WORDS[COMP_CWORD]}"
125 .Dl "   COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) )"
126 .Dl "   return 0"
127 .Dl "}"
128 .Dl "complete -F _service service"
129 .Sh SEE ALSO
130 .Xr bash 1 Pq Pa ports/shells/bash ,
131 .Xr rc.conf 5 ,
132 .Xr rc 8 ,
133 .Xr rcorder 8
134 .Sh HISTORY
135 The
136 .Nm
137 utility first appeared in
138 .Fx 7.3 .
139 .Sh AUTHORS
140 This
141 manual page was written by
142 .An Douglas Barton Aq Mt dougb@FreeBSD.org .