Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages


home | help
RC(8)			  BSD System Manager's Manual			 RC(8)

     rc	-- command scripts for auto-reboot and daemon startup


     Rc	is the command script which controls the automatic reboot (calling the
     other scripts) and	rc.local is the	script holding commands	which are per-
     tinent only to a specific site.  Typically, the /usr/local/etc/rc.d mech-
     anism is used instead of rc.local these days but if you do	want to	use
     rc.local, /etc/rc still supports it.  In this case, rc.local should
     source /etc/rc.conf and contain additional	custom startup code for	your
     system.  Rc.conf contains the global system configuration information
     referenced	by the rc files, while rc.conf.local contains the local	system
     configuration.  See rc.conf(5).

     The rc.d directories contain scripts which	will be	automatically executed
     at	boot time and shutdown time.  At boot time, the	specified directories
     are processed immediately after rc.local is executed.  (See below for de-
     tails on how to specify directories to check.)  At	shutdown time, the di-
     rectories are processed by	rc.shutdown.  The following key	points apply
     to	the scripts within each	directory:

     o	 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.
     o	 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 shut-
	 down time) the	script should exit successfully	and without producing
	 an error message.
     o	 The scripts within each directory are executed	in lexicographical or-
	 der.  If a specific order is required,	numbers	may be used as a pre-
	 fix to	the existing filenames,	so for example would be	exe-
	 cuted before; 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).

     The system	initialization scripts can execute scripts from	multiple rc.d
     directories.  The default locations are /usr/local/etc/rc.d and
     /usr/X11R6/etc/rc.d, but these may	be overridden with the local_startup
     rc.conf(5)	variable.

     Rc.shutdown is the	command	script which contains any necessary commands
     to	be executed as the system is shut down.

     When an automatic reboot is in progress, rc is invoked with the argument
     autoboot.	The first portion of rc	runs an	fsck(8)	with option -p to
     ``preen'' all the disks of	minor inconsistencies resulting	from the last
     system shutdown and to check for serious inconsistencies caused by	hard-
     ware or software failure.	If this	auto-check and repair succeeds,	then
     the second	part of	rc is run.

     The second	part of	rc, which is run after an auto-reboot succeeds and
     also if rc	is invoked when	a single user shell terminates (see init(8)),
     starts all	the daemons on the system, preserves editor files and clears
     the scratch directory /tmp.

     Rc.early is run very early	in the startup process,	immediately before the
     filesystem	check.

     Rc.serial is used to set any special configurations for serial devices.

     Rc.pccard is used to enable PC-cards.	is used	to start the network.  The network is started in three
     passes.  The first	pass sets the hostname and domainname, configures the
     network interfaces, turns on any IP firewall rules, and starts routing.
     The second	pass starts most of the	network	related	daemons.  The third
     pass starts NFS, amd, rwhod, Kerberos and the multicast routing daemon.

     Rc.firewall is used to configure rules for	the kernel based firewall ser-
     vice.  It has several possible options:

	   open	       will allow anyone in.
	   client      will try	to protect just	this machine.
	   simple      will try	to protect a whole network.
	   closed      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

     Rc.atm is used to configure ATM network interfaces.  The interfaces are
     configured	in three passes.  The first pass performs the initial inter-
     face configuration.  The second pass completes the	interface configura-
     tion and defines PVCs and permanent ATMARP	entries.  The third pass
     starts any	ATM daemons.

     Rc.<arch> runs architecture specific programs.

     Rc.local is executed after	the scripts above, but before the rest of the
     rc	file is	completed.  In a default installation rc.local does not	exist,
     but its contents will be executed if the file is created by the adminis-

     Following tradition, the startup files reside in /etc.

     The following is a	simple,	hypothetical example of	an rc.d	script,	which
     would start a daemon at boot time,	and kill it at shutdown	time.

	   #!/bin/sh -
	   #	initialization/shutdown	script for foobar package

	   case	"$1" in
		   /usr/local/sbin/foo -d && echo -n ' foo'
		   kill	`cat /var/run/` && echo -n ' foo'
		   echo	"unknown option: $1 - should be	'start'	or 'stop'" >&2

     As	all processes are killed by init(8) at shutdown, the explicit kill(1)
     is	unnecessary, but is often included.

     kill(1), rc.conf(5), init(8), reboot(8), savecore(8)

     The rc command appeared in	4.0BSD.

BSD			       December	11, 1993			   BSD


Want to link to this manual page? Use this URL:

home | help