rcctl8
Configure and control daemons and services
Usage
rcctl {get | getdef | set
daemon | service
[variable
[argument ...]]}
rcctl {[{-d | -q}]
[-f]
check | configtest | reload | restart | start | stop
daemon ...}
rcctl {disable | enable | order
[daemon ...]}
rcctl {ls
all | failed | off | on | rogue | started | stopped}
Overview
The rcctl utility can enable or disable a base system service or a base system or package daemon in rc.conf.local(8) or display its configuration and status. For a daemon, it can also change the command line arguments, the user to run as, the rc.d(8) action timeout or call its rc.d(8) daemon control script.
The following commands are available( variable can be one of class, execdir, flags, logger, rtable, status, timeout or user):
- [
-d|-q] [-f] action daemon ... -
Run the rc.d(8) daemon scripts with the action argument, passing through the specified options, if any.
disableservice ... | daemon ...-
Alias for
setservice|daemonstatusoff. enableservice ... | daemon ...-
Alias for
setservice|daemonstatuson. getservice | daemon [variable]-
Display the value of service or daemon_variable. If variable is empty, display all service or daemon variables and values in a format compatible with rc.conf(8). When daemon is set to "all", variable must not be set and
rcctlwill display all services and daemons variables. getdefservice | daemon [variable]-
Like
getbut returns the default values. lslsarg-
Display a list of services and daemons matching lsarg, which can be one of:
all-
all services and daemons
failed-
enabled but stopped daemons
off-
disabled services and daemons
on-
enabled services and daemons
rogue-
daemons which are disabled but currently running
started-
running daemons
stopped-
stopped daemons
order[daemon ...]-
Move the specified package daemons to the beginning of pkg_scripts. They need to be already enabled. If no daemon is specified, display the current order.
The
ordercommand 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. setservice | daemon variable [argument ...]-
For a daemon, set the variable daemon_variable to the specified arguments. If variable is already set, daemon_variable is reset to the optionally provided arguments or to its default value.
The
statusvariable must be provided with theonoroffarguments. It is used to enable or disable service or daemon in rc.conf.local(8). When a disabled package daemon is enabled, it is appended to the end of pkg_scripts. When a package daemon is disabled, it is removed from pkg_scripts and its variables are removed if any.
Exit status
rcctl action returns with the exit status of the rc.d(8) daemon script. rcctl get daemon | service [status] exits with 0 if the daemon or service is enabled and 1 if it is not. rcctl getdef daemon | service [status] exits with 0 if the daemon or service is enabled by default and 1 if it is not. rcctl ls failed | rogue exits with 1 if an enabled daemon is not running or vice versa. Otherwise, the rcctl utility exits with 0 on success, and >0 if an error occurs (2 indicates a non-existent daemon | service).
Examples
Enable and set apmd(8) flags:
# rcctl set apmd status on # rcctl set apmd flags -A # rcctl get apmd apmd_class=daemon apmd_execdir= apmd_flags=-A apmd_logger= apmd_rtable=0 apmd_timeout=30 apmd_user=root # echo $? 0
The recommended way to run a second copy of a given daemon for a different purpose is to create a symbolic link to its rc.d(8) control script:
# ln -s /etc/rc.d/snmpd /etc/rc.d/snmpd6 # rcctl set snmpd6 status on # rcctl set snmpd6 flags -D addr=2001:db8::1234 # rcctl start snmpd6
Releases
25 releases since OpenBSD 5.7; the text changed 13 times.