We said earlier that rc.subr(8) could provide default
methods. Obviously, such defaults cannot be too general.
They are suited for the common case of starting and shutting
down a simple daemon program. Let us assume now that we need
to write an rc.d
script for such a daemon
called mumbled
. Here it is:
#!/bin/sh . /etc/rc.subr name=mumbled rcvar=mumbled_enable command="/usr/sbin/${name}" load_rc_config $name run_rc_command "$1"
Pleasingly simple, isn't it? Let us examine our little script. The only new thing to note is as follows:
The The daemon will be started by running
Note:Some programs are in fact executable scripts. The
system runs such a script by starting its interpreter
and passing the name of the script to it as a command-line
argument. This is reflected in the list of processes,
which can confuse rc.subr(8). You should additionally
set For each Of course, sh(1) will permit you to set
For more detailed information on default methods, refer to rc.subr(8). |
All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/
Questions that are not answered by the
documentation may be
sent to <[email protected]>.
Send questions about this document to <[email protected]>.