1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
|
.\" $OpenBSD: rc.d.8,v 1.5 2011/03/10 16:49:48 ajacoutot Exp $
.\"
.\" Copyright (c) 2011 Robert Nagy, Antoine Jacoutot, Ingo Schwarze
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\"
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
.\" IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY DIRECT, INDIRECT,
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 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 SUCH DAMAGE.
.\"
.Dd $Mdocdate: March 10 2011 $
.Dt RC.D 8
.Os
.Sh NAME
.Nm rc.d
.Nd daemon control scripts
.Sh SYNOPSIS
.Nm /etc/rc.d/ Ns Ar daemon action
.Sh DESCRIPTION
The
.Pa /etc/rc.d
directory contains shell scripts to start, stop, and reconfigure daemon
programs
.Pq Dq services .
Currently, it is only used for daemons installed from
.Xr packages 7 ,
and not for the
.Ox
base system.
.Pp
Those services may be started at boot time in the order specified by the
.Va rc_scripts
variable from
.Xr rc.conf 8 ,
the order will be reversed during shutdown.
.Pp
Each such script responds to the following
.Ar actions :
.Pp
.Bl -tag -width restart -offset indent -compact
.It Cm start
Start the service, if not already running.
.It Cm stop
Stop the service.
.It Cm reload
Tell the daemon to reload its configuration.
.It Cm restart
Perform a stop, then a start.
.It Cm check
Return 0 if the daemon is running or 1 if it is not.
.El
.Pp
Each script defines its own defaults, some of which can be overridden
by site-specific values provided in
.Xr rc.conf.local 8
.Po
variable names are obtained by replacing
.Ar daemon
with the name of the actual script
.Pc :
.Pp
.Bl -tag -width daemon_flags -offset indent -compact
.It Ar daemon Ns _flags
Arguments to call the daemon with.
.It Ar daemon Ns _user
User to run the daemon as, using
.Xr su 1 .
.El
.Pp
For example, postgres is managed through
.Pa /etc/rc.d/postgresql .
To run the daemon using a site-specific user account, define the following in
.Xr rc.conf.local 8 :
.Pp
.Dl postgresql_user=mypgsqluser
.Sh FILES
.Bl -tag -width Ds
.It Pa /etc/rc.d/
Directory containing daemon control scripts.
.It Pa /etc/rc.d/rc.subr
Functions and variables used by
.Nm rc.d
scripts.
.El
.Sh SEE ALSO
.Xr rc 8 ,
.Xr rc.conf 8 ,
.Xr rc.subr 8
.Sh HISTORY
The
.Pa /etc/rc.d
directory
first appeared in
.Ox 4.9 .
.Sh BUGS
Changing flag values in
.Xr rc.conf.local 8
will change the corresponding pattern used with
.Xr pkill 1 ,
so that
.Ar actions
may not work on already running processes.
|