rc.d files
User documentation
16/02/2026
In BSD operating systems (FreeBSD, OpenBSD, NetBSD), files located in /etc/rc.d/ are shell scripts used for controlling system services and daemons at boot time, during shutdown, or manually by an administrator.
They are the core of the BSD "rc" startup system, managing services like networking, SSH, and system logging.
Key aspects of /etc/rc.d/ files include:
Service Management (Start/Stop/Reload): Each script typically supports standard commands to manage a daemon, such as start, stop, restart, reload, and status.
Daemonization: The scripts are designed to start processes in the background (as daemons) and often handle PID file creation.
Dependency Ordering (rcorder): The scripts are not executed in a simple alphabetical order. Instead, they contain special comments at the top (e.g., # PROVIDE, # REQUIRE) that rcorder(8) uses to determine the correct order of operations, ensuring services start only after their dependencies are met.
Controlled via rc.conf: These scripts are rarely edited directly. Instead, their behavior—specifically whether they start at boot—is controlled by variables set in /etc/rc.conf (e.g., sshd_enable="YES").
Third-Party Applications: While /etc/rc.d/ handles base system services, applications installed from ports or packages typically place their startup scripts in /usr/local/etc/rc.d/.
System Shutdown: During shutdown, these same scripts are run in reverse order (via /etc/rc.shutdown) to cleanly stop services.
In summary, they are the standard, modular way to manage service lifecycle in BSD systems.