daemon control scripts
The /etc/rc.d directory contains shell scripts to start,
stop, and reconfigure daemon programs (“services”).
Services installed from
packages(7) may be started
at boot time in the order specified by the pkg_scripts
variable from rc.conf(8);
the order will be reversed during shutdown. Services comprising
OpenBSD base are started by
The options are as follows:
- Setting this option will print the function names as they are called and
prevent the rc.subr(8)
framework from redirecting stdin and stderr to /dev/null. This is used to
allow debugging of failed actions.
- Setting this option will force operations with the given action. If
daemon_flags is set to “NO”, execution
will continue with the script's own defaults unless other flags are
Each such script responds to the following
Daemon control scripts use a fixed number of
sh(1) variables when starting a
daemon. The following two can be overridden by site-specific values provided
- Start the service, if not already running.
- Stop the service.
- Tell the daemon to reload its configuration.
- Perform a stop, then a start.
- Return 0 if the daemon is running or 1 if it is not.
- Arguments to call the daemon with. If set to “NO”, it will
prevent the daemon from starting even when listed in
- User to run the daemon as, using
To obtain the actual variable names, replace
daemon with the name of the script. For example,
postgres is managed through /etc/rc.d/postgresql. To
run the daemon using a site-specific user account, define the following in
Each script may define its own defaults, as explained in
daemon_class is a special read-only
variable. It is set to “daemon” unless there is a login class
login.conf(5) with the
same name as the
rc.d script itself, in which case
it will be set to that login class.
The /etc/rc.d directory first appeared in
- Directory containing daemon control scripts.
- Functions and variables used by