xref: /minix/usr.sbin/service/service.8 (revision 90b80121)
1.\"	$NetBSD: service.8,v 1.4 2015/04/02 18:41:22 ast Exp $
2.\"
3.\" Copyright (c) 2009 Douglas Barton
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.Dd March 20, 2015
28.Dt SERVICE 8
29.Os
30.Sh NAME
31.Nm service
32.Nd run or list system services
33.Sh SYNOPSIS
34.Nm
35.Op Fl elv
36.Nm
37.Op Fl ev
38.Ar rc_script_name1 Op Ar rc_script_name2 Op Ar ...
39.Nm
40.Op Fl v
41.Ar rc_script_name action
42.Sh DESCRIPTION
43The
44.Nm
45command is a simple interface to the services startup system.
46.Pp
47Its purpose is to list the services or invoke actions on them
48as provided by the
49.Ev rc.d
50scripts.
51When used to invoke
52.Ev rc.d
53scripts,
54.Nm
55will set the same environment that is used at boot time.
56.Pp
57The options are as follows:
58.Bl -tag -width F1
59.It Fl e
60List services that are enabled.
61The list of scripts is compiled using
62.Xr rcorder 8
63the same way as is done in
64.Xr rc 8 ;
65each script is first checked for an
66.Qq rcvar
67assignment and if present,
68checked to see if it is enabled.
69If one or more
70.Ar rc_script_name
71are specified, only those are checked.
72The
73.Ar rc_script_name
74arguments are always specified without a path prefix.
75.It Fl l
76List all files in
77.Pa /etc/rc.d
78(the default of
79.Ev rc_directories as defined in
80.Xr rc.conf 5 ) .
81A script will be listed unless it has the
82.Qq nostart
83keyword enabled.
84.It Fl v
85Report what
86.Ev rc_directories
87are defined or in which directory the
88.Ev rc.d script
89was found when an
90.Ar action
91is invoked.
92.El
93.Sh ENVIRONMENT
94When used to invoke
95.Ev rc.d scripts, the
96.Nm
97command sets
98.Ev umask
99to
100.Fa 022 ,
101.Ev HOME
102to
103.Pa / ,
104and
105.Ev PATH
106to
107.Pa /sbin:/bin:/usr/sbin:/usr/bin
108which is how they are set in
109.Pa /etc/rc
110at boot time.
111The
112.Ar action
113is typically one of
114.Ar start ,
115.Ar restart ,
116.Ar status ,
117or any other argument supported by the
118.Fa rc_script_name .
119.Sh EXIT STATUS
120.Ex -std
121.Sh EXAMPLES
122These are typical usages of the
123.Nm
124command:
125.Bd -literal
126# service sshd restart
127Stopping sshd.
128Starting sshd.
129.Ed
130.Bd -literal
131$ service -v inetd status
132inetd is located in /etc/rc.d
133inetd is running as pid 1713.
134.Ed
135.Bd -literal
136$ service -ve ccd motd hostapd my_pkg
137rc_directories is /etc/rc.d /usr/pkg/etc/rc.d
138/etc/rc.d/ccd
139/usr/pkg/etc/rc.d/my_pkg
140/etc/rc.d/motd
141.Ed
142.Pp
143In the last example,
144.Xr hostapd 8
145was apparently left disabled and the additional directory
146.Pa /usr/pkg/etc/rc.d
147was configured by redefining the variable
148.Ev rc_directories
149in
150.Pa rc.conf ;
151further,
152.Sy my_pkg=yes
153must have also been set.
154.Sh SEE ALSO
155.Xr rc.conf 5 ,
156.Xr rc 8 ,
157.Xr rcorder 8
158.Sh HISTORY
159The
160.Nm
161utility first appeared in
162.Nx 7.0 .
163.Sh AUTHORS
164.An -nosplit
165Written for
166.Fx
167by
168.An Douglas Barton Aq Mt dougb@FreeBSD.org .
169.Pp
170Adapted and extended to
171.Nx
172by
173.An Adrian Steinmann Aq Mt ast@marabu.ch .
174