Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Jul 2000 15:29:37 +0100
From:      Ben Smithurst <ben@FreeBSD.org>
To:        Sheldon Hearn <sheldonh@uunet.co.za>
Cc:        Alexander Langer <alex@big.endian.de>, freebsd-doc@FreeBSD.org
Subject:   Re: rc.d and rc.local
Message-ID:  <20000718152937.U4668@strontium.scientia.demon.co.uk>
In-Reply-To: <20000718150155.T4668@strontium.scientia.demon.co.uk>
References:  <20000718131849.L4668@strontium.scientia.demon.co.uk> <49493.963925685@axl.ops.uunet.co.za> <20000718150155.T4668@strontium.scientia.demon.co.uk>

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

--+k4Drb7WGefOwc9B
Content-Type: multipart/mixed; boundary="v15hXiddb3kq3Bam"
Content-Disposition: inline


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

> Hmm.  Having thought about it, I disagree.  But if you feel strongly
> enough, I'll do it that way.

Hmm, I've thought about it again, and I agree with you now about putting
it in the same page.  I'll make my mind up soon, honest. :-)

I plan to commit the two attached patches, unless anyone objects.

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

--v15hXiddb3kq3Bam
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rc.8.HEAD.diff"

Index: rc.8
===================================================================
RCS file: /usr/cvs/src/share/man/man8/rc.8,v
retrieving revision 1.10
diff -u -r1.10 rc.8
--- rc.8	2000/06/20 10:30:50	1.10
+++ rc.8	2000/07/18 14:23:59
@@ -42,6 +42,7 @@
 .Nm rc
 .Nm rc.conf
 .Nm rc.conf.local
+.Nm rc.d
 .Nm rc.serial
 .Nm rc.pccard
 .Nm rc.network
@@ -67,6 +68,59 @@
 .Nm rc.conf.local
 contains the local system configuration.  See rc.conf(5)
 .Pp
+The
+.Nm rc.d
+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 rc.d
+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 rc.d
+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 rc.d
+directory are expected to handle these arguments appropriately.
+If no action needs to be taken at a given time
+.Pq either boot time or shutdown time
+the script should exit successfully and without producing an error message.
+.El
+.Pp
+The output from each script is traditionally a space character,
+followed by the name of the software package being started or shutdown,
+.Em without
+a trailing newline character (see the
+.Sx EXAMPLES
+section).
+.Pp
+The system initialization scripts can execute scripts from multiple
+.Nm rc.d
+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 rc.d
+scripts.
+.Pp
 .Nm Rc.shutdown
 is the command script which contains any necessary commands
 to be executed as the system is shut down.
@@ -155,7 +209,37 @@
 .Pp
 Following tradition, the startup files reside in
 .Pa /etc .
+.Sh EXAMPLES
+The following is a simple, fictitious example of an
+.Nm rc.d
+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 && echo -n ' foo'
+	;;
+stop)
+	kill `cat /var/run/foo.pid` && echo -n ' foo'
+	;;
+*)
+	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 reboot 8 ,

--v15hXiddb3kq3Bam
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename="rc.8.RELENG_4.diff"

Index: rc.8
===================================================================
RCS file: /usr/cvs/src/share/man/man8/rc.8,v
retrieving revision 1.9.2.1
diff -u -r1.9.2.1 rc.8
--- rc.8	2000/06/20 10:32:11	1.9.2.1
+++ rc.8	2000/07/18 14:27:14
@@ -42,6 +42,7 @@
 .Nm rc
 .Nm rc.conf
 .Nm rc.conf.local
+.Nm rc.d
 .Nm rc.serial
 .Nm rc.pccard
 .Nm rc.network
@@ -67,6 +68,53 @@
 .Nm rc.conf.local
 contains the local system configuration.  See rc.conf(5)
 .Pp
+The
+.Nm rc.d
+directories contain scripts which will be automatically
+executed at boot time.
+The following key points apply to the scripts within each
+.Nm rc.d
+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 rc.d
+directory are silently ignored.
+.It
+When a script is executed, it is passed the string
+.Dq start
+as its first and only argument.
+All scripts within the
+.Nm rc.d
+directory are expected to handle this argument appropriately.
+.El
+.Pp
+The output from each script is traditionally a space character,
+followed by the name of the software package being started,
+.Em without
+a trailing newline character (see the
+.Sx EXAMPLES
+section).
+.Pp
+The system initialization scripts can execute scripts from multiple
+.Nm rc.d
+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 rc.d
+scripts.
+.Pp
 .Nm Rc.shutdown
 is the command script which contains any necessary commands
 to be executed as the system is shut down.
@@ -155,6 +203,25 @@
 .Pp
 Following tradition, the startup files reside in
 .Pa /etc .
+.Sh EXAMPLES
+The following is a simple, fictitious example of an
+.Nm rc.d
+script,
+which would start a daemon at boot time.
+.Bd -literal -offset indent
+#!/bin/sh -
+#
+#    initialization/shutdown script for foobar package
+
+case "$1" in
+start)
+	/usr/local/sbin/foo -d && echo -n ' foo'
+	;;
+*)
+	echo "unknown option: $1 - should be 'start'" >&2
+	;;
+esac
+.Ed
 .Sh SEE ALSO
 .Xr rc.conf 5 ,
 .Xr init 8 ,

--v15hXiddb3kq3Bam--

--+k4Drb7WGefOwc9B
Content-Type: application/pgp-signature
Content-Disposition: inline

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 5.0i for non-commercial use
MessageID: iCpH83LFKV3CMiZuyXTFQU+9kj6vRyRq

iQCVAwUBOXRp0CsPVtiZOS99AQEV1AP/VvTgR6CRlAWwlJ4NEpC0pvM3m1gDBkAQ
5BowOb1u5Eaeanxmh6ATsRwPZkg3h7+4Tv0iuVpVq26hdY7S/HfEA8UqeJR4WQuj
UVMXw4WFtajBvorOnNvo4Tca8WC/Xv+yl0Zq0NIsaJWryE6+50gdUri8j2/+0SOg
84Bf8Q/+9bU=
=+Lvy
-----END PGP SIGNATURE-----

--+k4Drb7WGefOwc9B--


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?20000718152937.U4668>