Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 17 Jul 2000 21:49:27 +0100
From:      Ben Smithurst <ben@FreeBSD.org>
To:        Nik Clayton <nik@freebsd.org>
Cc:        "Daniel C. Sobral" <dcs@newsguy.com>, freebsd-doc@freebsd.org
Subject:   Re: rc.d and rc.local
Message-ID:  <20000717214927.B4668@strontium.scientia.demon.co.uk>
In-Reply-To: <20000715031452.C20004@kilt.nothing-going-on.org>
References:  <396F6607.6C764850@newsguy.com> <20000715031452.C20004@kilt.nothing-going-on.org>

next in thread | previous in thread | raw e-mail | index | archive | help

--yLVHuoLXiP9kZBkt
Content-Type: multipart/mixed; boundary="6sX45UoQRIJXqkqR"
Content-Disposition: inline


--6sX45UoQRIJXqkqR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

Nik Clayton wrote:

> On Sat, Jul 15, 2000 at 04:12:07AM +0900, Daniel C. Sobral wrote:
>> The rc(8) man page has many remarks to the effect that rc.local has been
>> deprecated in favour of rc.d, but there is no man page about rc.d.
>> Something really ought to be done about this.
>=20
> Bollocks.  I hit ^C in the fetchmail window, and it didn't download your
> patch.  Can you resend it please?
>=20
> N  (:->)

ok, here's my first attempt at this.  It's probably a bit rough around
the edges, but it might provide a starting point.

--=20
Ben Smithurst                 / ben@FreeBSD.org / PGP: 0x99392F7D
FreeBSD Documentation Project /

--6sX45UoQRIJXqkqR
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rc.d.8"

.\" $FreeBSD$
.\"
.Dd July 17, 2000
.Dt RC.D 8
.Os FreeBSD
.Sh NAME
.Nm rc.d
.Nd command scripts for auto\-reboot and daemon startup
.Sh SYNOPSIS
.Nm rc.d
.Sh DESCRIPTION
The
.Nm
directories contain scripts which will be automatically
executed at boot time and shutdown time.
The following key points apply to the scripts within each
.Nm
directory:
.Pp
.Bl -bullet -compact
.It
Scripts are only executed if their filename matches
.Pa *.sh ,
and they have the execute bit set.
Any other files or directories present within the
.Nm
directory are silently ignored.
.It
When a script is executed at boot time, it is passed the string
.Dq start
as its first and only argument.
At shutdown time, it is passed the string
.Dq stop
as its first and only argument.
All scripts within the
.Nm
directory are expected to handle these arguments appropriately.
If no action needs to be taken at shutdown time,
the script should exit successfully and without producing an error message.
.El
.Pp
The system initialization scripts (see
.Xr rc 8 )
can execute scripts from multiple
.Nm
directories.
The default locations are
.Pa /usr/local/etc/rc.d
and
.Pa /usr/X11R6/etc/rc.d ,
but the administrator may specify different directories by setting the
.Dq local_startup
option of
.Xr rc.conf 5 .
This option's value should be a list of directories to check for
.Nm
scripts.
.Sh EXAMPLES
The following is a simple, fictitious example of an
.Nm
script,
which would start a daemon at boot time,
and kill it at shutdown time.
.Bd -literal -offset indent
#!/bin/sh -
#
#    initialization/shutdown script for foobar package

case "$1" in
start)
	/usr/local/sbin/foo -d
	;;
stop)
	kill `cat /var/run/foo.pid`
	;;
*)
	echo "unknown option: $1 - should be 'start' or 'stop'" >&2
	;;
esac
.Ed
.Pp
As all processes are killed by
.Xr init 8
at shutdown, the explicit
.Xr kill 1
is unnecessary, but is often included.
.Sh SEE ALSO
.Xr kill 1 ,
.Xr rc.conf 5 ,
.Xr init 8 ,
.Xr rc 8
.Sh AUTHORS
This manual page was written by
.An Ben Smithurst Aq ben@FreeBSD.org .

--6sX45UoQRIJXqkqR--

--yLVHuoLXiP9kZBkt
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
MessageID: aP56iJDIfeeZRXpDIW43zNS9Ur1N9vOv

iQCVAwUBOXNxVisPVtiZOS99AQEIwwP/QlE+mF8FjY88MrbUl+fTfbiVjTq59vKJ
HZXXmHlPkX2tpIjVmAQ9hqq36JViU4sciRiKfouzukqEGys9EW4qffJ2u2gQNjwL
3RVJ6dsTZDRyAxob++nZOt++jtD4jgHBzKttygbjAT6rnEXE8/5FzPI19zk/F4Py
ClptOy4rfxo=
=ZLuO
-----END PGP SIGNATURE-----

--yLVHuoLXiP9kZBkt--


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-doc" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20000717214927.B4668>