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