NAME
rc.d
—
daemon control scripts
SYNOPSIS
/etc/rc.d/daemon |
[-df ] action |
DESCRIPTION
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 rc(8).
The options are as follows:
-d
- 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.
-f
- This option only affects the
start
action. It will forcibly start the daemon whatever value daemon_flags is set to. If daemon_flags is set to “NO”, execution will continue with the script's own defaults unless other flags are specified.
Each such script responds to the following actions:
ENVIRONMENT
Daemon control scripts use a fixed number of sh(1) variables when starting a daemon. The following three can be overridden by site-specific values provided in rc.conf.local(8):
- daemon_flags
- Additional arguments to call the daemon with. These will be appended to any mandatory arguments already contained in the daemon variable defined in the control script. If daemon_flags is set to “NO”, it will prevent the daemon from starting even when listed in pkg_scripts.
- daemon_user
- User to run the daemon as, using su(1).
- daemon_timeout
- Maximum time in seconds to wait for the
start
,stop
andreload
actions to return.
To obtain the actual variable names, replace daemon with the name of the script. For example, postgres is managed through /etc/rc.d/postgresql:
daemon_flags=-l
/var/postgresql/logfile
To override this and increase the debug log level (keeping the existing logfile path), define the following in rc.conf.local(8):
postgresql_flags=-l
/var/postgresql/logfile -d 5
Each script may define its own defaults, as explained in rc.subr(8).
daemon_class is a special read-only
variable. It is set to “daemon” unless there is a login class
configured in
login.conf(5) with the same name as the
rc.d
script itself, in which case it will be set to
that login class.
FILES
- /etc/rc.d/
- Directory containing daemon control scripts.
- /etc/rc.d/rc.subr
- Functions and variables used by
rc.d
scripts. - /var/run/rc.d/
- Directory containing files recording the pexp variable used by pkill(1) for currently running daemons.
SEE ALSO
HISTORY
The /etc/rc.d directory first appeared in OpenBSD 4.9.