Difference between revisions of "Rcorder"
(→A Example rc Script) |
(→A Example rc Script) |
||
Line 31: | Line 31: | ||
!colspan="2"| | !colspan="2"| | ||
|- | |- | ||
− | |# PROVIDE: timed|| | + | |# PROVIDE: timed||PROVIDE tells the [https://www.freebsd.org/cgi/man.cgi?query=rcorder&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html rcorder(8)] the name of the script: ''timed''. |
|- | |- | ||
− | |# REQUIRE: DAEMON|| | + | |# REQUIRE: DAEMON||REQUIRE says which other scripts must run any time before the script ''timed''. |
|- | |- | ||
− | |# BEFORE: LOGIN|| | + | |# BEFORE: LOGIN||BEFORE says: ''timed'' must run before the LOGIN script. |
|- | |- | ||
− | |# KEYWORD: nojail shutdown|| | + | |# KEYWORD: nojail shutdown||The KEYWORD command lets select only special sturtup scripts. The [https://www.freebsd.org/cgi/man.cgi?query=timed&apropos=0&sektion=0&manpath=FreeBSD+12.1-RELEASE+and+Ports&arch=default&format=html ''timed(8)''] script ''nojail'' and ''shutdown''. Jail don't run this script. This script runs at system shutdown. |
|- | |- | ||
!colspan="2"| | !colspan="2"| | ||
|- | |- | ||
− | |. /etc/rc.subr|| | + | |. /etc/rc.subr||The ''/etc/rc.subr'' functions used by various rc scripts |
|- | |- | ||
!colspan="2"| | !colspan="2"| | ||
Line 47: | Line 47: | ||
|name="timed"|| | |name="timed"|| | ||
|- | |- | ||
− | |desc="Time server daemon"|| | + | |desc="Time server daemon"||description field, purpose of the script |
|- | |- | ||
− | |rcvar="timed_enable"|| | + | |rcvar="timed_enable"||lists the rc.conf variable that toggles this script |
|- | |- | ||
− | |command="/usr/sbin/${name}"|| | + | |command="/usr/sbin/${name}"||The command identifies which command this script should run after all. |
|- | |- | ||
!colspan="2"| | !colspan="2"| | ||
|- | |- | ||
− | |load_rc_config $name|| | + | |load_rc_config $name||load the the configuration for the service from /etc/[[Rc.conf|rc.conf]] |
|- | |- | ||
− | |run_rc_command "$1"|| | + | |run_rc_command "$1"||run the command |
|} | |} | ||
Revision as of 05:03, 25 March 2020
Welcome to Rcorder. |
OpenRC | ||
---|---|---|
Scripts | ||
/etc/rc rc - shell |
/etc/rc.devd The generic hook into OpenRC. |
/sbin/rcorder Ordering rc-scripts |
/etc/init.d Scripts to run OpenRC |
/usr/local/etc/init.d Scripts to run OpenRC |
|
/etc/rc.d Scripts automatically executed at boot and shutdown |
/usr/local/etc/rc.d Special scripts |
|
Configuration | ||
/etc/devd.conf Configuration file for devd(8) |
/etc/conf.d Initscript Configuration Files |
/etc/rc.conf.d Smaller configuration files |
/etc/defaults/rc.conf Specifies the default settings for all the available options. |
/etc/rc.conf The global OpenRC configuration file |
/etc/rc.conf.ghostbsd GhostBSD specific configurations |
Tools/Helper | ||
/usr/sbin/sysrc Safely edit system rc files |
/bin/rc-status Shows which services are running |
/sbin/rc-update Add or delete services |
/sbin/rc-service Locate and run an OpenRC service |
||
Back to the System |
Introduction
The rcorder utility is designed to print out a dependency ordering of a set of interdependent files. Typically it is used to find an execution sequence for a set of shell scripts in which certain files must be executed before others.
Each file passed to rcorder must be annotated with special lines (which look like comments to the shell) which indicate the dependencies the files have upon certain points in the sequence, known as "conditions", and which indicate, for each file, which "conditions" may be expected to be filled by that file.
rc Script Ordering
Each rc script identifies what resources it needs before it can start. Rcorder uses that information and sorts the scripts in the right order. The rcorder(8) sorts all the scripts in /etc/rc.d and /usr/local/etc/rc.d in to the order used at system boot. If your rc scripts have any ordering errors, those errors appear at the beginning of your rcorder(8) output.
A Example rc Script
Lines | Description |
---|---|
#!/bin/sh | |
# | |
# $FreeBSD$ | |
# | |
# PROVIDE: timed | PROVIDE tells the rcorder(8) the name of the script: timed. |
# REQUIRE: DAEMON | REQUIRE says which other scripts must run any time before the script timed. |
# BEFORE: LOGIN | BEFORE says: timed must run before the LOGIN script. |
# KEYWORD: nojail shutdown | The KEYWORD command lets select only special sturtup scripts. The timed(8) script nojail and shutdown. Jail don't run this script. This script runs at system shutdown. |
. /etc/rc.subr | The /etc/rc.subr functions used by various rc scripts |
name="timed" | |
desc="Time server daemon" | description field, purpose of the script |
rcvar="timed_enable" | lists the rc.conf variable that toggles this script |
command="/usr/sbin/${name}" | The command identifies which command this script should run after all. |
load_rc_config $name | load the the configuration for the service from /etc/rc.conf |
run_rc_command "$1" | run the command |