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

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

SYNOPSIS
     rc
     rc.conf
     rc.conf.local
     rc.early
     rc.d
     rc.serial
     rc.pccard
     rc.network
     rc.firewall
     rc.atm
     rc.<arch>
     rc.local
     rc.shutdown

DESCRIPTION
     Rc  is  the command script which controls the automatic reboot (calling the
     other scripts) and rc.local is the script holding commands which are perti-
     nent only to a specific site.  Typically, the /usr/local/etc/rc.d mechanism
     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:

     *	 Scripts are only executed if their basename(1) matches the shell  glob-
	 bing  pattern *.sh, and they are executable.  Any other files or direc-
	 tories 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 ex-
	 pected  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  or-
	 der.	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 be-
	 fore 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).

     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 hardware
     or software failure.  If this auto-check and repair succeeds, then the sec-
     ond 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.

     Rc.network 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  re-
		       quired).

     Rc.atm  is  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.

     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 administrator.

     Following tradition, the startup files reside in /etc.

EXAMPLES
     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
	   start)
		   /usr/local/sbin/foo -d && echo -n ' foo'
		   ;;
	   stop)
		   kill `cat /var/run/foo.pid` && echo -n ' foo'
		   ;;
	   *)
		   echo "unknown option: $1 - should be 'start' or 'stop'" >&2
		   ;;
	   esac

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

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

HISTORY
     The rc command appeared in 4.0BSD.

FreeBSD 4.7			December 11, 1993			   RC(8)

home | help