summaryrefslogtreecommitdiff
path: root/usr.sbin/rcctl/rcctl.8
blob: 7765bfc041d3f4e4418e89fba26fec8f4ca2e67c (plain)
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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
.\"	$OpenBSD: rcctl.8,v 1.12 2014/12/29 15:09:00 schwarze Exp $
.\"
.\" Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
.\"
.\" Permission to use, copy, modify, and distribute this software for any
.\" purpose with or without fee is hereby granted, provided that the above
.\" copyright notice and this permission notice appear in all copies.
.\"
.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
.Dd $Mdocdate: December 29 2014 $
.Dt RCCTL 8
.Os
.Sh NAME
.Nm rcctl
.Nd configure and control daemons and services
.Sh SYNOPSIS
.Nm rcctl
.Op Fl df
.Sm off
.Cm enable | disable | status | default | order | Ar action
.Sm on
.Op Ar service | daemon Oo Cm flags Oo Ar arguments Oc Oc | Ar daemons
.Sh DESCRIPTION
The
.Nm
utility can enable or disable a base system
.Ar service
or a base system or package
.Ar daemon
in
.Xr rc.conf.local 8
or display its status.
For a daemon, it can also change the command line arguments or call its
.Xr rc.d 8
.Ar daemon
control script.
.Pp
The following commands are available:
.Bl -tag -width Ds
.It Cm enable Ar service | daemon Op Cm flags Op Ar arguments
Enable the service or daemon in
.Xr rc.conf.local 8 .
When a disabled package daemon is enabled, it is appended to the end of
.Va pkg_scripts .
.Pp
For a daemon, optionally set the variable
.Ar daemon Ns _flags
to the specified
.Ar arguments .
If
.Cm flags
is appended without any
.Ar arguments ,
.Ar daemon Ns _flags
is reset to its default value.
If
.Ar daemon
is already enabled,
.Ar daemon Ns _flags
is reset to the optionally provided
.Cm flags .
.It Cm disable Ar service | daemon
Disable the service or daemon in
.Xr rc.conf.local 8 .
A package daemon is removed from
.Va pkg_scripts .
.It Cm status Op Ar service | daemon
Display the value of
.Ar service
or
.Ar daemon Ns _flags .
Without an argument, display all services and
.Ar daemon Ns _flags
with their values in a format compatible with
.Xr rc.conf 8 .
.It Cm default Op Ar service | daemon
For a daemon, display the flags that will be used if
.Dq Cm enable Ar daemon Cm flags
is called without
.Ar arguments .
For a base system service, display whether it is enabled by default.
.It Cm order Op Ar daemons
Move the specified package
.Ar daemons
to the beginning of
.Va pkg_scripts .
They need to be already enabled.
If
.Ar daemons
is empty, display the current order.
.Pp
The
.Cm order
command is only needed after enabling a new daemon
that needs to run before one or more already enabled daemons.
Specify the new daemon preceded by all that need to run before it,
but not the ones depending on it.
.It Oo Fl df Oc Ar action daemon
Run the
.Xr rc.d 8
.Ar daemon
script with the
.Ar action
argument, passing through the specified options, if any.
.El
.Sh EXIT STATUS
.Nm Ar action
returns with the exit status of the
.Xr rc.d 8
.Ar daemon
script.
.Nm Cm status
exits with 0 if the daemon or service is enabled and 1 if it is not.
.Nm Cm default
exits with 0 if the daemon or service is enabled by default
and 1 if it is not.
Otherwise, the
.Nm
utility exits 0 on success, and >0 if an error occurs
.Po 2 indicates a non-existent
.Ar service
.Pc .
.Sh EXAMPLES
Enable and set
.Xr ntpd 8
flags:
.Bd -literal -offset indent
# rcctl enable ntpd flags -s
# rcctl status ntpd
-s
# echo $?
0
.Ed
.Sh SEE ALSO
.Xr rc.conf.local 8 ,
.Xr rc.d 8
.Sh HISTORY
.Nm
first appeared in
.Ox 5.7 .
.Sh AUTHORS
.Nm
was written by
.An Antoine Jacoutot Aq Mt ajacoutot@openbsd.org .