Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/service/service.8
Show All 18 Lines | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd December 11, 2012 | .Dd April 24, 2016 | ||||
.Dt SERVICE 8 | .Dt SERVICE 8 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm service | .Nm service | ||||
.Nd "control (start/stop/etc.) or list system services" | .Nd "control (start/stop/etc.) or list system services" | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.Nm | .Nm | ||||
.Fl e | .Op Fl c Ar /path/to/rc.conf | ||||
.Ar name | |||||
.Cm enable|disable|delete|opts | |||||
.Nm | .Nm | ||||
.Fl R | .Fl e Op Fl n | ||||
.Nm | .Nm | ||||
.Op Fl v | .Op Fl v | ||||
.Fl l | r | .Fl l | r | ||||
.Nm | .Nm | ||||
.Fl R | |||||
.Nm | |||||
.Fl s | |||||
.Nm | |||||
.Op Fl v | .Op Fl v | ||||
.Ar <rc.d script> start|stop|etc. | .Ar name | ||||
.Cm start|stop|... | |||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Nm | .Nm | ||||
command is an easy interface to the rc.d system. | command is an easy interface to the rc.d system. | ||||
Its primary purpose is to start and stop services provided | Its primary purpose is to start and stop services provided | ||||
by the rc.d scripts. | by the rc.d scripts. | ||||
When used for this purpose it will set the same restricted | When used for this purpose it will set the same restricted | ||||
environment that is in use at boot time (see below). | environment that is in use at boot time (see below). | ||||
It can also be used to list | It can also be used to list | ||||
the scripts using various criteria. | the scripts using various criteria. | ||||
.Pp | .Pp | ||||
The options are as follows: | The options are as follows: | ||||
.Bl -tag -width F1 | .Bl -tag -width F1 | ||||
.It Fl c | |||||
The enable, disable, delete, and opts sub-commands operate on a specific config | |||||
file, rather than defaulting to | |||||
.Pa /etc/rc.conf.d/<name> . | |||||
.It Fl e | .It Fl e | ||||
List services that are enabled. | List services that are enabled by their rc.d script. | ||||
The | |||||
.Fl n | |||||
flag causes services to be listed by their name instead. | |||||
The list of scripts to check is compiled using | The list of scripts to check is compiled using | ||||
.Xr rcorder 8 | .Xr rcorder 8 | ||||
the same way that it is done in | the same way that it is done in | ||||
.Xr rc 8 , | .Xr rc 8 , | ||||
then that list of scripts is checked for an | then that list of scripts is checked for an | ||||
.Qq rcvar | .Qq rcvar | ||||
assignment. | assignment. | ||||
If present the script is checked to see if it is enabled. | If present the script is checked to see if it is enabled. | ||||
Show All 10 Lines | |||||
All files will be listed whether they are an actual | All files will be listed whether they are an actual | ||||
rc.d script or not. | rc.d script or not. | ||||
.It Fl r | .It Fl r | ||||
Generate the | Generate the | ||||
.Xr rcorder 8 | .Xr rcorder 8 | ||||
as in | as in | ||||
.Fl e | .Fl e | ||||
above, but list all of the files, not just what is enabled. | above, but list all of the files, not just what is enabled. | ||||
.It Fl s | |||||
Output the status of each enabled service. | |||||
.It Fl v | .It Fl v | ||||
Be slightly more verbose | Be slightly more verbose | ||||
.El | .El | ||||
.Sh SUBCOMMANDS | |||||
Any subcommand provided is passed to the rc.d script of the service, with the | |||||
exception of the following: | |||||
.Bl -tag -width disable | |||||
.It Cm enable | |||||
Enables the service by setting the <name>_enable rcvar to | |||||
.Qq YES . | |||||
Unless the | |||||
.Fl c | |||||
flag is specified, the change is written to | |||||
.Pa /etc/rc.conf.d/<name> . | |||||
.It Cm disable | |||||
Disables the service by setting the <name>_enable rcvar to | |||||
.Qq NO . | |||||
Unless the | |||||
.Fl c | |||||
flag is specified, the change is written to | |||||
.Pa /etc/rc.conf.d/<name> . | |||||
.It Cm delete | |||||
Deletes any <name>_enable rcvar entries from the config files | |||||
If the | |||||
.Fl c | |||||
flag is specified, only the indicated config file is changed. | |||||
.It Cm opts | |||||
Attempts to list the possible config options that can be specified for the | |||||
service. | |||||
.El | |||||
.Sh ENVIRONMENT | .Sh ENVIRONMENT | ||||
When used to run rc.d scripts the | When used to run rc.d scripts the | ||||
.Nm | .Nm | ||||
command sets | command sets | ||||
.Ev HOME | .Ev HOME | ||||
to | to | ||||
.Pa / | .Pa / | ||||
and | and | ||||
.Ev PATH | .Ev PATH | ||||
to | to | ||||
.Pa /sbin:/bin:/usr/sbin:/usr/bin | .Pa /sbin:/bin:/usr/sbin:/usr/bin | ||||
which is how they are set in | which is how they are set in | ||||
.Pa /etc/rc | .Pa /etc/rc | ||||
at boot time. | at boot time. | ||||
.Sh EXIT STATUS | .Sh EXIT STATUS | ||||
.Ex -std | .Ex -std | ||||
.Sh EXAMPLES | .Sh EXAMPLES | ||||
The following are examples of typical usage of the | The following are examples of typical usage of the | ||||
.Nm | .Nm | ||||
command: | command: | ||||
.Pp | .Pp | ||||
.Dl "service named enable" | |||||
.Dl "service named start" | |||||
.Dl "service named status" | .Dl "service named status" | ||||
.Dl "service named disable" | |||||
.Dl "service -rv" | .Dl "service -rv" | ||||
.Pp | .Pp | ||||
The following programmable completion entry can be use in | The following programmable completion entry can be use in | ||||
.Xr bash 1 | .Xr bash 1 | ||||
for the names of the rc.d scripts: | for the names of the rc.d scripts: | ||||
.Dl "_service () {" | .Dl "_service () {" | ||||
.Dl " local cur" | .Dl " local cur" | ||||
.Dl " cur=${COMP_WORDS[COMP_CWORD]}" | .Dl " cur=${COMP_WORDS[COMP_CWORD]}" | ||||
.Dl " COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) )" | .Dl " COMPREPLY=( $( compgen -W '$( service -l )' -- $cur ) )" | ||||
.Dl " return 0" | .Dl " return 0" | ||||
.Dl "}" | .Dl "}" | ||||
.Dl "complete -F _service service" | .Dl "complete -F _service service" | ||||
.Sh SEE ALSO | .Sh SEE ALSO | ||||
.Xr bash 1 Pq Pa ports/shells/bash , | .Xr bash 1 Pq Pa ports/shells/bash , | ||||
.Xr rc.conf 5 , | .Xr rc.conf 5 , | ||||
.Xr rc 8 , | .Xr rc 8 , | ||||
.Xr rcorder 8 | .Xr rcorder 8 , | ||||
.Xr sysrc 8 | |||||
.Sh HISTORY | .Sh HISTORY | ||||
The | The | ||||
.Nm | .Nm | ||||
utility first appeared in | utility first appeared in | ||||
.Fx 7.3 . | .Fx 7.3 . | ||||
.Sh AUTHORS | .Sh AUTHORS | ||||
This | This | ||||
manual page was written by | manual page was written by | ||||
.An Douglas Barton Aq Mt dougb@FreeBSD.org . | .An Douglas Barton Aq Mt dougb@FreeBSD.org . |