Scripts that are "placeholders" to ensure that certain operations are performed before others. In order of startup, these are:
NETWORKING
Ensure basic network services are running, including general network configuration (network1, network2, network3).
SERVERS
Ensure basic services (such as NETWORKING, ppp-user, syslogd, and isdnd) exist for services that start early (such as named), because they are required by DAEMON below.
DAEMON
Check-point before all general purpose daemons such as lpd and ntpd.
LOGIN
Check-point before user login services ( inetd and sshd), as well as services which might run commands as users ( cron and sendmail).
foo.sh
Scripts that are to be sourced into the current shell rather than a subshell have a .sh suffix. Extreme care must be taken in using this, as the startup sequence will terminate if the script does.
bar
Scripts that are sourced in a subshell. These can stop the boot if necessary with the following shell commands:
if [ "$autoboot" = yes ]; then
kill -TERM $$
fi
exit 1
Note that this should be used extremely sparingly!
Each script should contain rcorder(8) keywords, especially an appropriate "PROVIDE" entry, and if necessary "REQUIRE" and "BEFORE" keywords.
Each script is expected to support at least the following arguments, which are automatically supported if it uses the run_rc_command function:
start
Start the service. This should check that the service is to be started as specified by rc.conf(5). Also checks if the service is already running and refuses to start if it is. This latter check is not performed by standard .Fx scripts if the system is starting directly to multi-user mode, to speed up the boot process. If forcestart is given, ignore the rc.conf(5) check and start anyway.
stop
If the service is to be started as specified by rc.conf(5), stop the service. This should check that the service is running and complain if it is not. If forcestop is given, ignore the rc.conf(5) check and attempt to stop.
restart
Perform a stop then a start.
status
If the script starts a process (rather than performing a one-off operation), show the status of the process. Otherwise it is not necessary to support this argument. Defaults to displaying the process ID of the program (if running).
poll
If the script starts a process (rather than performing a one-off operation), wait for the command to exit. Otherwise it is not necessary to support this argument.
rcvar
Display which rc.conf(5) variables are used to control the startup of the service (if any).
If a script must implement additional commands it can list them in the extra_commands variable, and define their actions in a variable constructed from the command name (see the EXAMPLES section).
The following key points apply to old-style scripts in /usr/local/etc/rc.d/:
Scripts are only executed if their basename(1) matches the shell globbing pattern *.sh, and they are executable. Any other files or directories present within the directory are silently ignored.
When a script is executed at boot time, it is passed the string "start" as its first and only argument. At shutdown time, it is passed the string "stop" as its first and only argument. All rc.d/ scripts are expected to handle these arguments appropriately. If no action needs to be taken at a given time (either boot time or shutdown time), the script should exit successfully and without producing an error message.
The scripts within each directory are executed in lexicographical order. If a specific order is required, numbers may be used as a prefix to the existing filenames, so for example 100.foo would be executed before 200.bar; without the numeric prefixes the opposite would be true.
The output from each script is traditionally a space character, followed by the name of the software package being started or shut down, without a trailing newline character (see the EXAMPLES section).
totally disables IP services except via lo0 interface
UNKNOWN
disables the loading of firewall rules
filename
will load the rules in the given filename (full path required).
The /etc/rc.d/atm* scripts are used to configure ATM network interfaces. The interfaces are configured in three passes. The first pass performs the initial interface configuration. The second pass completes the interface configuration and defines PVCs and permanent ATMARP entries. The third pass starts any ATM daemons.
Most daemons, including network related daemons, have their own script in /etc/rc.d/, which can be used to start, stop, and check the status of the service.
Any architecture specific scripts, such as /etc/rc.d/apm for example, specifically check that they are on that architecture before starting the daemon.
Following tradition, all startup files reside in /etc.