Update the example rc.d script:

1. Add a $FreeBSD$ tag
2. Add KEYWORD: shutdown
3. Change %%RC_SUBR%% to /etc/rc.subr

Add a paragraph of text explaining why REQUIRE: LOGIN is preferred,
and when to use KEYWORD: shutdown.

While I'm here update the copyright. Happy 2010. :)
This commit is contained in:
Doug Barton 2009-12-31 21:14:16 +00:00
parent 798e078f96
commit 83f04e3f5e
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=35129

View file

@ -30,6 +30,7 @@
<year>2007</year>
<year>2008</year>
<year>2009</year>
<year>2010</year>
<holder role="mailto:doc@FreeBSD.org">The FreeBSD Documentation
Project</holder>
</copyright>
@ -8446,9 +8447,11 @@ CFLAGS+= -DLUA_VERSION_STRING="${VER_STR}"
<para>Example simple <filename>rc.d</filename> script:</para>
<programlisting>#!/bin/sh
# $FreeBSD$
#
# PROVIDE: doormand
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
# to enable this service:
@ -8459,7 +8462,7 @@ CFLAGS+= -DLUA_VERSION_STRING="${VER_STR}"
# by default.
#
. %%RC_SUBR%%
. /etc/rc.subr
name="doormand"
rcvar=${name}_enable
@ -8476,6 +8479,16 @@ command_args="-p $pidfile -f $doormand_config"
run_rc_command "$1"</programlisting>
<para> Unless there is a good reason to start the service
earlier all ports scripts should use
<programlisting>REQUIRE: LOGIN</programlisting>. If the service
runs as a particular user (other than root) this is mandatory.
The <programlisting>KEYWORD: shutdown</programlisting>
included in the script above is there because the mythical port
we are using as an example starts a service, and should be shut
down cleanly when the system shuts down. If the script is not
starting a persistent service this is not necessary.</para>
<para>The &quot;=&quot; style of default variable assignment
is preferable to the &quot;:=&quot; style here, since the
former sets a default value only if the variable is unset,