xref: /openbsd-src/usr.sbin/rcctl/rcctl.8 (revision 4f37b6d8348814d18455d660970182911f6f21f8)
1*4f37b6d8Skn.\"	$OpenBSD: rcctl.8,v 1.46 2024/09/29 14:36:13 kn Exp $
279f09f3fSajacoutot.\"
379f09f3fSajacoutot.\" Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org>
479f09f3fSajacoutot.\"
579f09f3fSajacoutot.\" Permission to use, copy, modify, and distribute this software for any
679f09f3fSajacoutot.\" purpose with or without fee is hereby granted, provided that the above
779f09f3fSajacoutot.\" copyright notice and this permission notice appear in all copies.
879f09f3fSajacoutot.\"
979f09f3fSajacoutot.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
1079f09f3fSajacoutot.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
1179f09f3fSajacoutot.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
1279f09f3fSajacoutot.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
1379f09f3fSajacoutot.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
1479f09f3fSajacoutot.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
1579f09f3fSajacoutot.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
1679f09f3fSajacoutot.\"
17*4f37b6d8Skn.Dd $Mdocdate: September 29 2024 $
1879f09f3fSajacoutot.Dt RCCTL 8
1979f09f3fSajacoutot.Os
2079f09f3fSajacoutot.Sh NAME
2179f09f3fSajacoutot.Nm rcctl
2227153228Sschwarze.Nd configure and control daemons and services
2379f09f3fSajacoutot.Sh SYNOPSIS
2479f09f3fSajacoutot.Nm rcctl
25aa7681c9Sschwarze.Cm get Ns | Ns Cm getdef Ns | Ns Cm set
26*4f37b6d8Skn.Ar daemon Ns | Ns Ar service Op Ar variable Op Ar argument ...
27aa7681c9Sschwarze.Nm rcctl
28f5d98dd5Sajacoutot.Op Fl df
298cf991a5Sjmc.Sm off
304165b2aaSjmc.Cm check | configtest | reload | restart | start | stop
318cf991a5Sjmc.Sm on
328cf991a5Sjmc.Ar daemon ...
33aa7681c9Sschwarze.Nm rcctl
3469671cdbSjmc.Cm disable Ns | Ns Cm enable Ns | Ns Cm order
35aa7681c9Sschwarze.Op Ar daemon ...
36aa7681c9Sschwarze.Nm rcctl
37aa7681c9Sschwarze.Cm ls
388cf991a5Sjmc.Sm off
394165b2aaSjmc.Cm all | failed | off | on | rogue | started | stopped
408cf991a5Sjmc.Sm on
4179f09f3fSajacoutot.Sh DESCRIPTION
42ea15528cSschwarzeThe
4379f09f3fSajacoutot.Nm
44ea15528cSschwarzeutility can enable or disable a base system
45ea15528cSschwarze.Ar service
46ea15528cSschwarzeor a base system or package
47ea15528cSschwarze.Ar daemon
48ea15528cSschwarzein
49ea15528cSschwarze.Xr rc.conf.local 8
50d5d80d44Sajacoutotor display its configuration and status.
51d7eb808dSajacoutotFor a
52d7eb808dSajacoutot.Ar daemon ,
53d7eb808dSajacoutotit can also change the command line arguments, the user to run as, the
5459a10a9fSajacoutot.Xr rc.d 8
55d7eb808dSajacoutotaction timeout or call its
5679f09f3fSajacoutot.Xr rc.d 8
57ea15528cSschwarze.Ar daemon
58ea15528cSschwarzecontrol script.
5979f09f3fSajacoutot.Pp
60a55cbbd7SajacoutotThe following commands are available
6159a10a9fSajacoutot.Po
62d5d80d44Sajacoutot.Ar variable
63d5d80d44Sajacoutotcan be one of
64e19db557Sajacoutot.Cm class ,
65ae8581a2Sajacoutot.Cm execdir ,
6626d5efdaSschwarze.Cm flags ,
679cd4f3a5Sajacoutot.Cm logger ,
6877d37598Sajacoutot.Cm rtable ,
6926d5efdaSschwarze.Cm status ,
7026d5efdaSschwarze.Cm timeout
71d5d80d44Sajacoutotor
7226d5efdaSschwarze.Cm user
73a55cbbd7Sajacoutot.Pc :
7427153228Sschwarze.Bl -tag -width Ds
753a5ffbf1Sschwarze.It Oo Fl df Oc Ar action daemon ...
76a3563a50SajacoutotRun the
77a3563a50Sajacoutot.Xr rc.d 8
783a5ffbf1Sschwarze.Ar daemon
79c2ffd898Sajacoutotscripts with the
80a3563a50Sajacoutot.Ar action
81a3563a50Sajacoutotargument, passing through the specified options, if any.
8232c19508Sajacoutot.It Cm disable Ar service ... | daemon ...
8332c19508SajacoutotAlias for
8469671cdbSjmc.Cm set Ar service Ns | Ns Ar daemon Cm status off .
8532c19508Sajacoutot.It Cm enable Ar service ... | daemon ...
8632c19508SajacoutotAlias for
8769671cdbSjmc.Cm set Ar service Ns | Ns Ar daemon Cm status on .
88d7eb808dSajacoutot.It Cm get Ar service | daemon Op Ar variable
8979f09f3fSajacoutotDisplay the value of
9027153228Sschwarze.Ar service
9179f09f3fSajacoutotor
9226d5efdaSschwarze.Ar daemon Ns _ Ns Ar variable .
93d7eb808dSajacoutotIf
94d7eb808dSajacoutot.Ar variable
95d7eb808dSajacoutotis empty, display all
96d7eb808dSajacoutot.Ar service
97d7eb808dSajacoutotor
98d5d80d44Sajacoutot.Ar daemon
99d7eb808dSajacoutotvariables and values in a format
100d5d80d44Sajacoutotcompatible with
101c18897cfSajacoutot.Xr rc.conf 8 .
1024727ebb7SajacoutotWhen
1034727ebb7Sajacoutot.Ar daemon
1044727ebb7Sajacoutotis set to
1054727ebb7Sajacoutot.Qq all ,
1064727ebb7Sajacoutot.Ar variable
1074727ebb7Sajacoutotmust not be set and
1084727ebb7Sajacoutot.Nm
1094727ebb7Sajacoutotwill display all services and daemons variables.
110a3563a50Sajacoutot.It Cm getdef Ar service | daemon Op Ar variable
111a3563a50SajacoutotLike
112a3563a50Sajacoutot.Cm get
113a3563a50Sajacoutotbut returns the default values.
114a3563a50Sajacoutot.It Cm ls Ar lsarg
115a3563a50SajacoutotDisplay a list of services and daemons matching
116420d5729Sschwarze.Ar lsarg ,
117420d5729Sschwarzewhich can be one of:
118a3563a50Sajacoutot.Pp
119ee0a7f8eSschwarze.Bl -tag -width stopped -offset indent -compact
120420d5729Sschwarze.It Cm all
121a3563a50Sajacoutotall services and daemons
12298a0419bSajacoutot.It Cm failed
123a3563a50Sajacoutotenabled but stopped daemons
124420d5729Sschwarze.It Cm off
125a3563a50Sajacoutotdisabled services and daemons
126420d5729Sschwarze.It Cm on
127a3563a50Sajacoutotenabled services and daemons
128c91a9b26Ssthen.It Cm rogue
129c91a9b26Ssthendaemons which are disabled but currently running
130420d5729Sschwarze.It Cm started
131a3563a50Sajacoutotrunning daemons
132420d5729Sschwarze.It Cm stopped
133a3563a50Sajacoutotstopped daemons
134a3563a50Sajacoutot.El
1353a5ffbf1Sschwarze.It Cm order Op Ar daemon ...
1363a5ffbf1SschwarzeMove the specified package daemons to the beginning of
137a3563a50Sajacoutot.Va pkg_scripts .
138a3563a50SajacoutotThey need to be already enabled.
1393a5ffbf1SschwarzeIf no
1403a5ffbf1Sschwarze.Ar daemon
1413a5ffbf1Sschwarzeis specified, display the current order.
142a3563a50Sajacoutot.Pp
143a3563a50SajacoutotThe
144a3563a50Sajacoutot.Cm order
145a3563a50Sajacoutotcommand is only needed after enabling a new daemon
146a3563a50Sajacoutotthat needs to run before one or more already enabled daemons.
147a3563a50SajacoutotSpecify the new daemon preceded by all that need to run before it,
148a3563a50Sajacoutotbut not the ones depending on it.
149881f6c5fSkn.It Cm set Ar service | daemon variable Op Ar argument ...
150d5d80d44SajacoutotFor a daemon, set the variable
15126d5efdaSschwarze.Ar daemon Ns _ Ns Ar variable
152881f6c5fSknto the specified arguments.
153d5d80d44SajacoutotIf
15426d5efdaSschwarze.Ar variable
155d5d80d44Sajacoutotis already set,
15626d5efdaSschwarze.Ar daemon Ns _ Ns Ar variable
157b1668e29Sajacoutotis reset to the optionally provided arguments or to its default value.
158d5d80d44Sajacoutot.Pp
159d5d80d44SajacoutotThe
16026d5efdaSschwarze.Cm status
16126d5efdaSschwarze.Ar variable
16226d5efdaSschwarzemust be provided with the
16326d5efdaSschwarze.Cm on
164d5d80d44Sajacoutotor
16526d5efdaSschwarze.Cm off
166881f6c5fSknarguments.
167d7eb808dSajacoutotIt is used to enable or disable
168d7eb808dSajacoutot.Ar service
169d7eb808dSajacoutotor
170d7eb808dSajacoutot.Ar daemon
171d7eb808dSajacoutotin
172d5d80d44Sajacoutot.Xr rc.conf.local 8 .
173d5d80d44SajacoutotWhen a disabled package daemon is enabled, it is appended to the end of
174d5d80d44Sajacoutot.Va pkg_scripts .
175d5d80d44SajacoutotWhen a package daemon is disabled, it is removed from
176e500f7b4Ssolene.Va pkg_scripts
177e500f7b4Ssoleneand its variables are removed if any.
17879f09f3fSajacoutot.El
17979f09f3fSajacoutot.Sh EXIT STATUS
18079f09f3fSajacoutot.Nm Ar action
18179f09f3fSajacoutotreturns with the exit status of the
18279f09f3fSajacoutot.Xr rc.d 8
18327153228Sschwarze.Ar daemon
18479f09f3fSajacoutotscript.
18526d5efdaSschwarze.Nm Cm get Ar daemon | service Op Cm status
18627153228Sschwarzeexits with 0 if the daemon or service is enabled and 1 if it is not.
18726d5efdaSschwarze.Nm Cm getdef Ar daemon | service Op Cm status
188891bc8f4Sschwarzeexits with 0 if the daemon or service is enabled by default
189891bc8f4Sschwarzeand 1 if it is not.
190bc06dd15Sajacoutot.Nm Cm ls failed | rogue
191bc06dd15Sajacoutotexits with 1 if an enabled daemon is not running or vice versa.
19279f09f3fSajacoutotOtherwise, the
19379f09f3fSajacoutot.Nm
194d7eb808dSajacoutotutility exits with 0 on success, and >0 if an error occurs
1953f961c3dSajacoutot.Po 2 indicates a non-existent
196d5d80d44Sajacoutot.Ar daemon | service
1973f961c3dSajacoutot.Pc .
19879f09f3fSajacoutot.Sh EXAMPLES
19979f09f3fSajacoutotEnable and set
2001965a55dSajacoutot.Xr apmd 8
20179f09f3fSajacoutotflags:
20279f09f3fSajacoutot.Bd -literal -offset indent
2031965a55dSajacoutot# rcctl set apmd status on
2041965a55dSajacoutot# rcctl set apmd flags -A
2051965a55dSajacoutot# rcctl get apmd
2061965a55dSajacoutotapmd_class=daemon
207ae8581a2Sajacoutotapmd_execdir=
208df5fa2b1Sajacoutotapmd_flags=-A
2099cd4f3a5Sajacoutotapmd_logger=
210c62c0b67Sajacoutotapmd_rtable=0
2111965a55dSajacoutotapmd_timeout=30
2121965a55dSajacoutotapmd_user=root
21379f09f3fSajacoutot# echo $?
21479f09f3fSajacoutot0
21579f09f3fSajacoutot.Ed
2166771c5c9Sschwarze.Pp
2176771c5c9SschwarzeThe recommended way to run a second copy of a given daemon for a
2186771c5c9Sschwarzedifferent purpose is to create a symbolic link to its
2196771c5c9Sschwarze.Xr rc.d 8
2206771c5c9Sschwarzecontrol script:
2216771c5c9Sschwarze.Bd -literal -offset indent
2226771c5c9Sschwarze# ln -s /etc/rc.d/snmpd /etc/rc.d/snmpd6
2236771c5c9Sschwarze# rcctl set snmpd6 status on
2241cd9ed26Sajacoutot# rcctl set snmpd6 flags -D addr=2001:db8::1234
2256771c5c9Sschwarze# rcctl start snmpd6
2266771c5c9Sschwarze.Ed
22779f09f3fSajacoutot.Sh SEE ALSO
22879f09f3fSajacoutot.Xr rc.conf.local 8 ,
22979f09f3fSajacoutot.Xr rc.d 8
23079f09f3fSajacoutot.Sh HISTORY
23179f09f3fSajacoutot.Nm
23279f09f3fSajacoutotfirst appeared in
23379f09f3fSajacoutot.Ox 5.7 .
23479f09f3fSajacoutot.Sh AUTHORS
23579f09f3fSajacoutot.Nm
23679f09f3fSajacoutotwas written by
23779f09f3fSajacoutot.An Antoine Jacoutot Aq Mt ajacoutot@openbsd.org .
238