diff options
Diffstat (limited to 'documentation/content/en/articles/rc-scripting/_index.adoc')
-rw-r--r-- | documentation/content/en/articles/rc-scripting/_index.adoc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/documentation/content/en/articles/rc-scripting/_index.adoc b/documentation/content/en/articles/rc-scripting/_index.adoc index e9e5ef0389..14e0ad4bb4 100644 --- a/documentation/content/en/articles/rc-scripting/_index.adoc +++ b/documentation/content/en/articles/rc-scripting/_index.adoc @@ -91,7 +91,7 @@ Now a typical script can be just a few lines' worth of man:sh[1] code. Finally, an important part of the [.filename]#rc.d# framework is man:rcorder[8], which helps [.filename]#/etc/rc# to run the small scripts orderly with respect to dependencies between them. It can help [.filename]#/etc/rc.shutdown#, too, because the proper order for the shutdown sequence is opposite to that of startup. -The BSD [.filename]#rc.d# design is described in <<lukem, the original article by Luke Mewburn>>, and the [.filename]#rc.d# components are documented in great detail in <<manpages, the respective manual pages>>. +The BSD [.filename]#rc.d# design is described in crossref:rc-scripting[lukem, the original article by Luke Mewburn], and the [.filename]#rc.d# components are documented in great detail in crossref:rc-scripting[manpages, the respective manual pages]. However, it might not appear obvious to an [.filename]#rc.d# newbie how to tie the numerous bits and pieces together to create a well-styled script for a particular task. Therefore this article will try a different approach to describe [.filename]#rc.d#. It will show which features should be used in a number of typical cases, and why. @@ -186,7 +186,7 @@ That is, each [.filename]#rc.d# script _must_ set `name` before it calls man:rc. Now it is the right time to choose a unique name for our script once and for all. We will use it in a number of places while developing the script. The content of the name variable needs to match the script name, -some parts of FreeBSD (e.g., <<rcng-service-jails, service jails>> and the cpuset feature of the rc framework) depend upon this. +some parts of FreeBSD (e.g., crossref:rc-scripting[rcng-service-jails, service jails] and the cpuset feature of the rc framework) depend upon this. As such the filename shall also not contain characters which may be troublesome in scripting (e.g., do not use a hyphen "-" and others). [NOTE] @@ -367,7 +367,8 @@ This is reflected in the list of processes, which can confuse man:rc.subr[8]. You should additionally set `command_interpreter` to let man:rc.subr[8] know the actual name of the process if `$command` is a script. For each [.filename]#rc.d# script, there is an optional man:rc.conf[5] variable that takes precedence over `command`. -Its name is constructed as follows: `${name}_program`, where `name` is the mandatory variable we discussed <<name-var, earlier>>. +Its name is constructed as follows: `${name}_program`, where `name` is the +mandatory variable we discussed crossref:rc-scripting[name-var, earlier]. E.g., in this case it will be `mumbled_program`. It is man:rc.subr[8] that arranges `${name}_program` to override `command`. @@ -450,7 +451,7 @@ Since the final command line is passed to `eval` for its actual execution, input _Never_ include dashed options, like `-X` or `--foo`, in `command_args`. The contents of `command_args` will appear at the end of the final command line, hence they are likely to follow arguments present in `${name}_flags`; but most commands will not recognize dashed options after ordinary arguments. A better way of passing additional options to `$command` is to add them to the beginning of `${name}_flags`. -Another way is to modify `rc_flags` <<rc-flags, as shown later>>. +Another way is to modify `rc_flags` crossref:rc-scripting[rc-flags, as shown later]. ==== ➋ A good-mannered daemon should create a _pidfile_ so that its process can be found more easily and reliably. @@ -677,7 +678,7 @@ Keep in mind that putting a service name in the `REQUIRE:` line does not guarant The required service may fail to start or just be disabled in man:rc.conf[5]. Obviously, man:rcorder[8] cannot track such details, and man:rc[8] will not do that either. Consequently, the application started by our script should be able to cope with any required services being unavailable. -In certain cases, we can help it as discussed <<forcedep, below>> +In certain cases, we can help it as discussed crossref:rc-scripting[forcedep, below] ==== [[keywords]]➍ As we remember from the above text, man:rcorder[8] keywords can be used to select or leave out some scripts. |