RCCTL(8)

NAME
rcctl - configure and control daemons and services

SYNOPSIS
rcctl get|getdef|set service | daemon [variable [arguments]]
rcctl [-df] check|reload|restart|stop|start daemon ...
rcctl disable|enable|order [daemon ...]
rcctl ls all|failed|on|off|rogue|started|stopped

DESCRIPTION
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, 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.

disable service ... | daemon ...
    Alias for set service|daemon status off.

enable service ... | daemon ...
    Alias for set service|daemon status on.

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

getdef service | daemon [variable]
    Like get but returns the default values.

ls lsarg
    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 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.

set service | daemon variable [arguments]
    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.

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 exits with 1 if an enabled daemon is not running. 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_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

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

HISTORY
rcctl first appeared in OpenBSD 5.7.

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