Rcctl

(redirected from Rcctl.Rcctl)

rcctl(8) is a utility to manage /etc/rc.conf.local, for running, killing and managing system services. thankfully since rcctl is part of base system, nothing is needed to install it.

Commands

ls

rcctl ls can be used for list-ing kinds of services examples:

$ doas rcctl ls failed
$ doas rcctl ls on

check

to check if a service is still running or not, use rcctl check for example:

$ doas rcctl check vmd

if vmd is running:

vmd(ok)

otherwise:

vmd(failed)

enable

rcctl enable enables services, making them executed on next boot. it doesn't show anything after running. see start for starting a service without rebooting.

$ doas rcctl enable xenodm

disable

rcctl disable disables services, and don't let them to run on next boot. you might want to stop these as well.

rcctl disable xendom

start

rcctl start is for starting services which are allowed to run. if you try to run a disabled service, following will happen:

$ doas rcctl start sndiod
/etc/rc.d/sndiod: need -f to force start since sndiod_flags=NO

you can enable it's service, or use rcctl start -f to start it without enabling it.

in both cases, you will see this:

sndiod(ok)

stop

rcctl stop stops running services, if a service is not running or not enabled, it won't say anything.

 
$doas rcctl stop sndiod
sndiod(ok)

restart

rcctl restart it first stop services, then starts them again (thats why it shows two). this is useful for when you have updated configurations. however, you most use reload always. (unless service is stopped or it doesn't support reload)

$doas rcctl restart smtpd
smtpd(ok)
smtpd(ok)

reload

rcctl reload is used to tell a service to reload it's configuration files. it's useful for places such as an irc server which restarting will cause all users getting disconnected. not all services support this action. it will send a signal to called service in order to reload it:

$ doas rcctl reload nsd
nsd(ok)

set

some deamons ship with custom flags to change their functionality instad of a config file, you can change them with flags if they are enabled. apmd is a example of following, you can set -H to apmd to set maximum perforamce mode on apmd

$ doas rcctl set apmd flags -H

get

you can get information from services (no matter if they are running or not) using rcctl get:

$ rcctl get pflogd
pflogd_class=daemon
pflogd_flags=
pflogd_logger=
pflogd_rtable=0
pflogd_timeout=30
pflogd_user=root

See Also

rcctl(8) man page, rc.d(8) man page and rc.conf.local(8) man page