OpenBSD manual page server

Manual Page Search Parameters

RCCTL(8) System Manager's Manual RCCTL(8)

rcctlconfigure and control daemons and services

rcctl get|getdef|set daemon|service [variable [argument ...]]

rcctl [-df] check|configtest|reload|restart|start|stop daemon ...

rcctl disable|enable|order [daemon ...]

rcctl ls all|failed|off|on|rogue|started|stopped

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):

[-df] action daemon ...
Run the rc.d(8) daemon scripts with the action argument, passing through the specified options, if any.
service ... | daemon ...
Alias for set service|daemon status off.
service ... | daemon ...
Alias for set service|daemon status on.
service | 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 rcctl will display all services and daemons variables.
service | daemon [variable]
Like get but returns the default values.
lsarg
Display a list of services and daemons matching lsarg, which can be one of:

all services and daemons
enabled but stopped daemons
disabled services and daemons
enabled services and daemons
daemons which are disabled but currently running
running daemons
stopped daemons
[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 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.

service | 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 status variable must be provided with the on or off arguments. 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.

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).

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

rc.conf.local(8), rc.d(8)

rcctl first appeared in OpenBSD 5.7.

rcctl was written by Antoine Jacoutot <ajacoutot@openbsd.org>.

September 29, 2024 OpenBSD-current