diff options
-rw-r--r-- | documentation/content/en/articles/rc-scripting/_index.adoc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/documentation/content/en/articles/rc-scripting/_index.adoc b/documentation/content/en/articles/rc-scripting/_index.adoc index 750072951e..bc939aec04 100644 --- a/documentation/content/en/articles/rc-scripting/_index.adoc +++ b/documentation/content/en/articles/rc-scripting/_index.adoc @@ -685,6 +685,29 @@ From all the files to be dependency sorted, man:rcorder[8] will pick only those In FreeBSD, man:rcorder[8] is used by [.filename]#/etc/rc# and [.filename]#/etc/rc.shutdown#. These two scripts define the standard list of FreeBSD [.filename]#rc.d# keywords and their meanings as follows: +nojail:: The service is not for man:jail[8] environment. +The automatic startup and shutdown procedures will ignore the script if inside a jail. + +nostart:: The service is to be started manually or not started at all. +The automatic startup procedure will ignore the script. +In conjunction with the [.filename]#shutdown# keyword, this can be used to write scripts that do something only at system shutdown. + +shutdown:: This keyword is to be listed __explicitly__ if the service needs to be stopped before system shutdown. + +[NOTE] +==== +When the system is going to shut down, [.filename]#/etc/rc.shutdown# runs. +It assumes that most [.filename]#rc.d# scripts have nothing to do at that time. +Therefore [.filename]#/etc/rc.shutdown# selectively invokes [.filename]#rc.d# scripts with the [.filename]#shutdown# keyword, effectively ignoring the rest of the scripts. +For even faster shutdown, [.filename]#/etc/rc.shutdown# passes the [.filename]#faststop# command to the scripts it runs so that they skip preliminary checks, e.g., the pidfile check. +As dependent services should be stopped before their prerequisites, [.filename]#/etc/rc.shutdown# runs the scripts in reverse dependency order. +If writing a real [.filename]#rc.d# script, you should consider whether it is relevant at system shutdown time. +E.g., if your script does its work in response to the [.filename]#start# command only, then you need not to include this keyword. +However, if your script manages a service, it is probably a good idea to stop it before the system proceeds to the final stage of its shutdown sequence described in man:halt[8]. +In particular, a service should be stopped explicitly if it needs considerable time or special actions to shut down cleanly. +A typical example of such a service is a database engine. +==== + [[forcedep]]➎ To begin with, `force_depend` should be used with much care. It is generally better to revise the hierarchy of configuration variables for your [.filename]#rc.d# scripts if they are interdependent. |