1 .\" Copyright (c) 2009 Douglas Barton
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
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.
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
30 .Nd "control (start/stop/etc.) or list system services"
55 command is an easy interface to the rc.d system.
56 Its primary purpose is to start and stop services provided
58 When used for this purpose it will set the same restricted
59 environment that is in use at boot time
64 It can also be used to list
65 the scripts using various criteria.
67 The options are as follows:
70 Set the environment variable
74 before starting the script.
75 This option can be used multiple times.
77 List services that are enabled.
78 The list of scripts to check is compiled using
80 the same way that it is done in
82 then that list of scripts is checked for an
85 If present the script is checked to see if it is enabled.
87 Perform the given actions under the named jail.
90 argument can be either a jail ID or a jail name.
94 and the local startup directories.
98 .Pa /usr/local/etc/rc.d .
99 All files will be listed whether they are an actual
102 Restart all enabled local services.
108 above, but list all of the files, not just what is enabled.
110 Be slightly more verbose.
113 When used to run rc.d scripts the
122 .Pa /sbin:/bin:/usr/sbin:/usr/bin
123 which is how they are set in
128 option is used, the corresponding variable is set accordingly.
132 The following are examples of typical usage of the
135 .Bd -literal -offset -ident
137 service -j dns named status
138 service -E LC_ALL=C.UTF-8 named start
142 The following programmable completion entry can be used in
144 for the names and common commands of the rc.d scripts:
145 .Bd -literal -offset indent
146 complete service 'c/-/(e l r v)/' 'p/1/`service -l`/' \e
147 'n/*/(start stop reload restart \e
148 status rcvar onestart onestop)/'
151 The following programmable completion entry can be used in
153 for the names of the rc.d scripts:
154 .Bd -literal -offset -ident
157 cur=${COMP_WORDS[COMP_CWORD]}
158 COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) )
161 complete -F _service service
164 .Xr bash 1 Pq Pa ports/shells/bash ,
171 utility first appeared in
175 manual page was written by
176 .An Douglas Barton Aq Mt dougb@FreeBSD.org .