xref: /freebsd/usr.sbin/service/service.8 (revision 7aa383846770374466b1dcb2cefd71bde9acf463)
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 December 26, 2009
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.Fl e
36.Nm
37.Op Fl v
38.Fl l | r
39.Nm
40.Op Fl v
41.Ar <rc.d script> start|stop|etc.
42.Sh DESCRIPTION
43The
44.Nm
45command is an easy interface to the rc.d system.
46Its primary purpose is to start and stop services provided
47by the rc.d scripts.
48When used for this purpose it will set the same restricted
49environment that is in use at boot time (see below).
50It can also be used to list
51the scripts using various criteria.
52.Pp
53The options are as follows:
54.Bl -tag -width F1
55.It Fl e
56List services that are enabled.
57The list of scripts to check is compiled using
58.Xr rcorder 8
59the same way that it is done in
60.Xr rc 8 ,
61then that list of scripts is checked for an
62.Qq rcvar
63assignment.
64If present the script is checked to see if it is enabled.
65.It Fl l
66List all files in
67.Pa /etc/rc.d
68and the local startup directories.
69As described in
70.Xr rc.conf 5
71this is usually
72.Pa /usr/local/etc/rc.d .
73All files will be listed whether they are an actual
74rc.d script or not.
75.It Fl r
76Generate the
77.Xr rcorder 8
78as in
79.Fl e
80above, but list all of the files, not just what is enabled.
81.It Fl v
82Be slightly more verbose
83.El
84.Sh ENVIRONMENT
85When used to run rc.d scripts the
86.Nm
87command sets
88.Ev HOME
89to
90.Pa /
91and
92.Ev PATH
93to
94.Pa /sbin:/bin:/usr/sbin:/usr/bin
95which is how they are set in
96.Pa /etc/rc
97at boot time.
98.Sh EXIT STATUS
99.Ex -std
100.Sh EXAMPLES
101The following are examples of typical usage of the
102.Nm
103command:
104.Pp
105.Dl "service named status"
106.Dl "service -rv"
107.Pp
108The following programmable completion entry can be use in
109.Xr bash 1
110for the names of the rc.d scripts:
111.Dl "_service () {"
112.Dl "	local cur"
113.Dl "	cur=${COMP_WORDS[COMP_CWORD]}"
114.Dl "	COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) )"
115.Dl "	return 0"
116.Dl "}"
117.Dl "complete -F _service service"
118.Sh SEE ALSO
119.Xr bash 1 Pq Pa ports/shells/bash ,
120.Xr rc.conf 5 ,
121.Xr rc 8 ,
122.Xr rcorder 8
123.Sh HISTORY
124The
125.Nm
126manual page service first appeared in
127.Fx 7.3 .
128.Sh AUTHORS
129This
130manual page was written by
131.An Douglas Barton <dougb@FreeBSD.org> .
132