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 49The 50.Nm 51command is an easy interface to the rc.d system. 52Its primary purpose is to start and stop services provided 53by the rc.d scripts. 54When used for this purpose it will set the same restricted 55environment that is in use at boot time (see below). 56It can also be used to list 57the scripts using various criteria. 58.Pp 59The options are as follows: 60.Bl -tag -width F1 61.It Fl j Ao jail name or id Ac 62Perform the given actions under the named jail. 63.It Fl e 64List services that are enabled. 65The list of scripts to check is compiled using 66.Xr rcorder 8 67the same way that it is done in 68.Xr rc 8 , 69then that list of scripts is checked for an 70.Qq rcvar 71assignment. 72If present the script is checked to see if it is enabled. 73.It Fl R 74Restart all enabled local services. 75.It Fl l 76List all files in 77.Pa /etc/rc.d 78and the local startup directories. 79As described in 80.Xr rc.conf 5 81this is usually 82.Pa /usr/local/etc/rc.d . 83All files will be listed whether they are an actual 84rc.d script or not. 85.It Fl r 86Generate the 87.Xr rcorder 8 88as in 89.Fl e 90above, but list all of the files, not just what is enabled. 91.It Fl v 92Be slightly more verbose 93.El 94.Sh ENVIRONMENT 95When used to run rc.d scripts the 96.Nm 97command sets 98.Ev HOME 99to 100.Pa / 101and 102.Ev PATH 103to 104.Pa /sbin:/bin:/usr/sbin:/usr/bin 105which is how they are set in 106.Pa /etc/rc 107at boot time. 108.Sh EXIT STATUS 109.Ex -std 110.Sh EXAMPLES 111The following are examples of typical usage of the 112.Nm 113command: 114.Pp 115.Dl "service named status" 116.Dl "service -j dns named status" 117.Dl "service -rv" 118.Pp 119The following programmable completion entry can be use in 120.Xr bash 1 121for 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 135The 136.Nm 137utility first appeared in 138.Fx 7.3 . 139.Sh AUTHORS 140This 141manual page was written by 142.An Douglas Barton Aq Mt dougb@FreeBSD.org . 143