1.\" $OpenBSD: rcctl.8,v 1.33 2016/06/19 10:54:20 ajacoutot Exp $ 2.\" 3.\" Copyright (c) 2014 Antoine Jacoutot <ajacoutot@openbsd.org> 4.\" 5.\" Permission to use, copy, modify, and distribute this software for any 6.\" purpose with or without fee is hereby granted, provided that the above 7.\" copyright notice and this permission notice appear in all copies. 8.\" 9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16.\" 17.Dd $Mdocdate: June 19 2016 $ 18.Dt RCCTL 8 19.Os 20.Sh NAME 21.Nm rcctl 22.Nd configure and control daemons and services 23.Sh SYNOPSIS 24.Nm rcctl 25.Cm get Ns | Ns Cm getdef Ns | Ns Cm set 26.Ar service | daemon Op Ar variable Op Ar arguments 27.Nm rcctl 28.Op Fl df 29.Ar action daemon ... 30.Nm rcctl 31.Cm disable Ns | Ns Cm enable Ns | Ns Cm order 32.Op Ar daemon ... 33.Nm rcctl 34.Cm ls 35.Ar lsarg 36.Sh DESCRIPTION 37The 38.Nm 39utility can enable or disable a base system 40.Ar service 41or a base system or package 42.Ar daemon 43in 44.Xr rc.conf.local 8 45or display its configuration and status. 46For a 47.Ar daemon , 48it can also change the command line arguments, the user to run as, the 49.Xr rc.d 8 50action timeout or call its 51.Xr rc.d 8 52.Ar daemon 53control script. 54.Pp 55The following commands are available 56.Po 57.Ar variable 58can be one of 59.Cm class , 60.Cm flags , 61.Cm status , 62.Cm timeout 63or 64.Cm user 65.Pc : 66.Bl -tag -width Ds 67.It Oo Fl df Oc Ar action daemon ... 68Run the 69.Xr rc.d 8 70.Ar daemon 71scripts with the 72.Ar action 73argument, passing through the specified options, if any. 74.It Cm disable Ar service ... | daemon ... 75Alias for 76.Cm set Ar service Ns | Ns Ar daemon Cm status off . 77.It Cm enable Ar service ... | daemon ... 78Alias for 79.Cm set Ar service Ns | Ns Ar daemon Cm status on . 80.It Cm get Ar service | daemon Op Ar variable 81Display the value of 82.Ar service 83or 84.Ar daemon Ns _ Ns Ar variable . 85If 86.Ar variable 87is empty, display all 88.Ar service 89or 90.Ar daemon 91variables and values in a format 92compatible with 93.Xr rc.conf 8 . 94When 95.Ar daemon 96is set to 97.Qq all , 98.Ar variable 99must not be set and 100.Nm 101will display all services and daemons variables. 102.It Cm getdef Ar service | daemon Op Ar variable 103Like 104.Cm get 105but returns the default values. 106.It Cm ls Ar lsarg 107Display a list of services and daemons matching 108.Ar lsarg , 109which can be one of: 110.Pp 111.Bl -tag -width started -offset indent -compact 112.It Cm all 113all services and daemons 114.It Cm failed 115enabled but stopped daemons 116.It Cm off 117disabled services and daemons 118.It Cm on 119enabled services and daemons 120.It Cm started 121running daemons 122.It Cm stopped 123stopped daemons 124.El 125.It Cm order Op Ar daemon ... 126Move the specified package daemons to the beginning of 127.Va pkg_scripts . 128They need to be already enabled. 129If no 130.Ar daemon 131is specified, display the current order. 132.Pp 133The 134.Cm order 135command is only needed after enabling a new daemon 136that needs to run before one or more already enabled daemons. 137Specify the new daemon preceded by all that need to run before it, 138but not the ones depending on it. 139.It Cm set Ar service | daemon variable Op Ar arguments 140For a daemon, set the variable 141.Ar daemon Ns _ Ns Ar variable 142to the specified 143.Ar arguments . 144If 145.Ar variable 146is already set, 147.Ar daemon Ns _ Ns Ar variable 148is reset to the optionally provided 149.Ar arguments 150or to its default value. 151.Pp 152The 153.Cm status 154.Ar variable 155must be provided with the 156.Cm on 157or 158.Cm off 159.Ar arguments . 160It is used to enable or disable 161.Ar service 162or 163.Ar daemon 164in 165.Xr rc.conf.local 8 . 166When a disabled package daemon is enabled, it is appended to the end of 167.Va pkg_scripts . 168When a package daemon is disabled, it is removed from 169.Va pkg_scripts . 170.El 171.Sh EXIT STATUS 172.Nm Ar action 173returns with the exit status of the 174.Xr rc.d 8 175.Ar daemon 176script. 177.Nm Cm get Ar daemon | service Op Cm status 178exits with 0 if the daemon or service is enabled and 1 if it is not. 179.Nm Cm getdef Ar daemon | service Op Cm status 180exits with 0 if the daemon or service is enabled by default 181and 1 if it is not. 182.Nm Cm ls failed 183exits with 1 if an enabled daemon is not running. 184Otherwise, the 185.Nm 186utility exits with 0 on success, and >0 if an error occurs 187.Po 2 indicates a non-existent 188.Ar daemon | service 189.Pc . 190.Sh EXAMPLES 191Enable and set 192.Xr apmd 8 193flags: 194.Bd -literal -offset indent 195# rcctl set apmd status on 196# rcctl set apmd flags -A 197# rcctl get apmd 198apmd_class=daemon 199apmd_flags=-A 200apmd_rtable=0 201apmd_timeout=30 202apmd_user=root 203# echo $? 2040 205.Ed 206.Pp 207The recommended way to run a second copy of a given daemon for a 208different purpose is to create a symbolic link to its 209.Xr rc.d 8 210control script: 211.Bd -literal -offset indent 212# ln -s /etc/rc.d/snmpd /etc/rc.d/snmpd6 213# rcctl set snmpd6 status on 214# rcctl set snmpd6 flags -D addr=2001:db8::1234 215# rcctl start snmpd6 216.Ed 217.Sh SEE ALSO 218.Xr rc.conf.local 8 , 219.Xr rc.d 8 220.Sh HISTORY 221.Nm 222first appeared in 223.Ox 5.7 . 224.Sh AUTHORS 225.Nm 226was written by 227.An Antoine Jacoutot Aq Mt ajacoutot@openbsd.org . 228