2002-06-21 17:56:16 +02:00
|
|
|
.\" $NetBSD: rcorder.8,v 1.3 2000/07/17 14:16:22 mrg Exp $
|
2001-06-16 09:16:14 +02:00
|
|
|
.\"
|
|
|
|
.\" Copyright (c) 1998
|
2016-09-16 06:08:34 +02:00
|
|
|
.\" Perry E. Metzger. All rights reserved.
|
2001-06-16 09:16:14 +02:00
|
|
|
.\"
|
|
|
|
.\" Redistribution and use in source and binary forms, with or without
|
|
|
|
.\" modification, are permitted provided that the following conditions
|
|
|
|
.\" are met:
|
|
|
|
.\" 1. Redistributions of source code must retain the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer.
|
|
|
|
.\" 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
.\" notice, this list of conditions and the following disclaimer in the
|
|
|
|
.\" documentation and/or other materials provided with the distribution.
|
|
|
|
.\" 3. All advertising materials mentioning features or use of this software
|
|
|
|
.\" must display the following acknowledgment:
|
|
|
|
.\" This product includes software developed for the NetBSD Project
|
|
|
|
.\" by Perry E. Metzger.
|
|
|
|
.\" 4. The name of the author may not be used to endorse or promote products
|
|
|
|
.\" derived from this software without specific prior written permission.
|
|
|
|
.\"
|
|
|
|
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
|
|
|
|
.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
|
|
|
.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
|
|
|
|
.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
|
|
|
|
.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
|
|
|
.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
|
|
.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
|
|
.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
|
|
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
|
|
|
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
.\"
|
2023-06-16 18:48:17 +02:00
|
|
|
.Dd June 10, 2023
|
2001-06-16 09:16:14 +02:00
|
|
|
.Dt RCORDER 8
|
|
|
|
.Os
|
|
|
|
.Sh NAME
|
|
|
|
.Nm rcorder
|
|
|
|
.Nd print a dependency ordering of interdependent files
|
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2020-09-08 12:36:11 +02:00
|
|
|
.Op Fl gp
|
2001-06-16 09:16:14 +02:00
|
|
|
.Op Fl k Ar keep
|
|
|
|
.Op Fl s Ar skip
|
|
|
|
.Ar
|
|
|
|
.Sh DESCRIPTION
|
2002-07-06 21:34:37 +02:00
|
|
|
The
|
2001-06-16 09:16:14 +02:00
|
|
|
.Nm
|
2002-07-06 21:34:37 +02:00
|
|
|
utility is designed to print out a dependency ordering of a set of
|
2002-11-25 17:23:03 +01:00
|
|
|
interdependent files.
|
|
|
|
Typically it is used to find an execution
|
2001-06-16 09:16:14 +02:00
|
|
|
sequence for a set of shell scripts in which certain files must be
|
|
|
|
executed before others.
|
|
|
|
.Pp
|
|
|
|
Each file passed to
|
|
|
|
.Nm
|
|
|
|
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
|
|
|
|
.Dq conditions ,
|
|
|
|
and which indicate, for each file, which
|
|
|
|
.Dq conditions
|
|
|
|
may be expected to be filled by that file.
|
|
|
|
.Pp
|
|
|
|
Within each file, a block containing a series of
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql REQUIRE ,
|
|
|
|
.Ql PROVIDE ,
|
|
|
|
.Ql BEFORE
|
2001-06-16 09:16:14 +02:00
|
|
|
and
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql KEYWORD
|
2001-06-16 09:16:14 +02:00
|
|
|
lines must appear.
|
2002-11-25 17:23:03 +01:00
|
|
|
The format of the lines is rigid.
|
|
|
|
Each line must begin with a single
|
|
|
|
.Ql # ,
|
2001-06-16 09:16:14 +02:00
|
|
|
followed by a single space, followed by
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql PROVIDE\&: ,
|
|
|
|
.Ql REQUIRE\&: ,
|
|
|
|
.Ql BEFORE\&: ,
|
2001-06-16 09:16:14 +02:00
|
|
|
or
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql KEYWORD\&: .
|
2001-06-16 09:16:14 +02:00
|
|
|
No deviation is permitted.
|
|
|
|
Each dependency line is then followed by a series of conditions,
|
2002-11-25 17:23:03 +01:00
|
|
|
separated by whitespace.
|
|
|
|
Multiple
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql PROVIDE ,
|
|
|
|
.Ql REQUIRE ,
|
|
|
|
.Ql BEFORE
|
2001-06-16 09:16:14 +02:00
|
|
|
and
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql KEYWORD
|
2002-06-21 17:56:16 +02:00
|
|
|
lines may appear, but all such lines must appear in a sequence without
|
2001-06-16 09:16:14 +02:00
|
|
|
any intervening lines, as once a line that does not follow the format
|
|
|
|
is reached, parsing stops.
|
2011-08-06 11:13:09 +02:00
|
|
|
.\" Note that for historical reasons REQUIRES, PROVIDES, and KEYWORDS
|
|
|
|
.\" are also accepted in addition to the above, but not documented so
|
|
|
|
.\" that they can be deprecated at some point in the future.
|
2001-06-16 09:16:14 +02:00
|
|
|
.Pp
|
|
|
|
The options are as follows:
|
2020-06-22 12:01:24 +02:00
|
|
|
.Bl -tag -width "-k keep"
|
2020-09-08 12:36:11 +02:00
|
|
|
.It Fl g
|
|
|
|
Produce a GraphViz (.dot) of the complete dependency graph instead of
|
|
|
|
plaintext calling order list.
|
2020-06-22 12:01:24 +02:00
|
|
|
.It Fl k Ar keep
|
2001-06-16 09:16:14 +02:00
|
|
|
Add the specified keyword to the
|
2002-11-25 17:23:03 +01:00
|
|
|
.Dq "keep list" .
|
2001-06-16 09:16:14 +02:00
|
|
|
If any
|
|
|
|
.Fl k
|
|
|
|
option is given, only those files containing the matching keyword are listed.
|
2020-06-22 12:01:24 +02:00
|
|
|
This option can be specified multiple times.
|
2020-09-08 12:36:11 +02:00
|
|
|
.It Fl p
|
|
|
|
Generate ordering suitable for parallel startup, placing files that can be
|
|
|
|
executed simultaneously on the same line.
|
2020-06-22 12:01:24 +02:00
|
|
|
.It Fl s Ar skip
|
2001-06-16 09:16:14 +02:00
|
|
|
Add the specified keyword to the
|
2002-11-25 17:23:03 +01:00
|
|
|
.Dq "skip list" .
|
2001-06-16 09:16:14 +02:00
|
|
|
If any
|
|
|
|
.Fl s
|
|
|
|
option is given, files containing the matching keyword are not listed.
|
2020-06-22 12:01:24 +02:00
|
|
|
This option can be specified multiple times.
|
2001-06-16 09:16:14 +02:00
|
|
|
.El
|
|
|
|
.Pp
|
2004-07-02 20:37:52 +02:00
|
|
|
An example block follows:
|
2001-06-16 09:16:14 +02:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
# REQUIRE: networking syslog
|
|
|
|
# REQUIRE: usr
|
|
|
|
# PROVIDE: dns nscd
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
This block states that the file in which it appears depends upon the
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql networking ,
|
|
|
|
.Ql syslog ,
|
2001-06-16 09:16:14 +02:00
|
|
|
and
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql usr
|
2001-06-16 09:16:14 +02:00
|
|
|
conditions, and provides the
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql dns
|
2001-06-16 09:16:14 +02:00
|
|
|
and
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql nscd
|
2001-06-16 09:16:14 +02:00
|
|
|
conditions.
|
|
|
|
.Pp
|
|
|
|
A file may contain zero
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql PROVIDE
|
2001-06-16 09:16:14 +02:00
|
|
|
lines, in which case it provides no conditions, and may contain zero
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql REQUIRE
|
2001-06-16 09:16:14 +02:00
|
|
|
lines, in which case it has no dependencies.
|
|
|
|
There must be at least one file with no dependencies in the set of
|
|
|
|
arguments passed to
|
|
|
|
.Nm
|
|
|
|
in order for it to find a starting place in the dependency ordering.
|
2018-10-27 19:21:13 +02:00
|
|
|
.Sh KEYWORDS
|
|
|
|
There are several
|
|
|
|
.Em KEYWORDs
|
|
|
|
in use:
|
2020-06-22 12:01:24 +02:00
|
|
|
.Bl -tag -width "shutdown" -offset indent
|
|
|
|
.It Sy firstboot , nojail , nojailvnet , nostart
|
2018-10-27 19:21:13 +02:00
|
|
|
Used by
|
|
|
|
.Xr rc 8 .
|
2023-06-16 18:48:17 +02:00
|
|
|
.It Sy suspend , resume
|
2018-10-27 19:21:13 +02:00
|
|
|
Used by
|
2023-06-16 18:48:17 +02:00
|
|
|
.Nm /etc/rc.suspend
|
|
|
|
and
|
2018-10-27 19:21:13 +02:00
|
|
|
.Nm /etc/rc.resume
|
|
|
|
(see
|
|
|
|
.Xr acpiconf 8 )
|
2020-06-22 12:01:24 +02:00
|
|
|
.It Sy shutdown
|
2018-10-27 19:21:13 +02:00
|
|
|
Used by
|
|
|
|
.Xr rc.shutdown 8 .
|
|
|
|
.El
|
2020-06-22 12:01:24 +02:00
|
|
|
.Sh EXAMPLES
|
|
|
|
Print the dependency ordering of the services from the base system and
|
|
|
|
.Xr ports 7 :
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
$ rcorder /etc/rc.d/* /usr/local/etc/rc.d/*
|
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
Count the number of services in the base system, which specify the
|
2022-12-13 20:49:52 +01:00
|
|
|
.Sy nostart
|
2020-06-22 12:01:24 +02:00
|
|
|
keyword, while skipping those with
|
|
|
|
.Sy firstboot
|
|
|
|
and
|
|
|
|
.Sy nojailvnet :
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
$ rcorder -k nostart -s firstboot -s nojailvnet /etc/rc.d/* | wc -l
|
|
|
|
3
|
|
|
|
.Ed
|
2001-06-16 09:16:14 +02:00
|
|
|
.Sh DIAGNOSTICS
|
2002-07-06 21:34:37 +02:00
|
|
|
The
|
2001-06-16 09:16:14 +02:00
|
|
|
.Nm
|
2002-07-06 21:34:37 +02:00
|
|
|
utility may print one of the following error messages and exit with a non-zero
|
2001-06-16 09:16:14 +02:00
|
|
|
status if it encounters an error while processing the file list.
|
|
|
|
.Bl -diag
|
2020-09-08 12:36:11 +02:00
|
|
|
.It "Requirement %s in file %s has no providers."
|
2001-06-16 09:16:14 +02:00
|
|
|
No file has a
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql PROVIDE
|
2001-06-16 09:16:14 +02:00
|
|
|
line corresponding to a condition present in a
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql REQUIRE
|
2001-06-16 09:16:14 +02:00
|
|
|
line in another file.
|
2020-09-08 12:36:11 +02:00
|
|
|
.It "Circular dependency on provision %s in file %s."
|
2001-06-16 09:16:14 +02:00
|
|
|
A set of files has a circular dependency which was detected while
|
|
|
|
processing the stated condition.
|
2020-09-08 12:36:11 +02:00
|
|
|
Loop visualization follows this message.
|
|
|
|
.It "Circular dependency on file %s."
|
2001-06-16 09:16:14 +02:00
|
|
|
A set of files has a circular dependency which was detected while
|
|
|
|
processing the stated file.
|
2020-09-08 12:36:11 +02:00
|
|
|
.It "%s was seen in circular dependencies for %d times."
|
|
|
|
Each node that was a part of circular dependency loops reports total number of
|
|
|
|
such encounters.
|
|
|
|
Start with files having biggest counter when fighting with broken dependencies.
|
2001-06-16 09:16:14 +02:00
|
|
|
.El
|
2020-09-08 12:36:11 +02:00
|
|
|
.Sh DIAGNOSTICS WITH GRAPHVIZ
|
|
|
|
Direct dependency is drawn with solid line,
|
|
|
|
.Ql BEFORE
|
|
|
|
dependency is drawn as a dashed line.
|
|
|
|
Each node of a graph represents an item from
|
|
|
|
.Ql PROVIDE
|
|
|
|
lines.
|
|
|
|
In case there are more than one file providing an item, a list of filenames
|
|
|
|
shortened with
|
|
|
|
.Xr basename 3
|
|
|
|
is shown.
|
|
|
|
Shortened filenames are also shown in case
|
|
|
|
.Ql PROVIDE
|
|
|
|
item does not match file name.
|
|
|
|
.Pp
|
|
|
|
Edges and nodes where circular dependencies were detected are drawn bold red.
|
|
|
|
If a file has an item in
|
|
|
|
.Ql REQUIRE
|
|
|
|
or in
|
|
|
|
.Ql BEFORE
|
|
|
|
that could not be provided,
|
2024-01-12 06:27:08 +01:00
|
|
|
this missing provider and the requirement will be drawn in bold red as well.
|
2010-05-13 14:07:55 +02:00
|
|
|
.Sh SEE ALSO
|
2018-10-27 19:21:13 +02:00
|
|
|
.Xr acpiconf 8 ,
|
|
|
|
.Xr rc 8 ,
|
2020-06-22 12:01:24 +02:00
|
|
|
.Xr rc.shutdown 8 ,
|
|
|
|
.Xr service 8
|
2010-05-13 14:07:55 +02:00
|
|
|
.Sh HISTORY
|
|
|
|
The
|
|
|
|
.Nm
|
2016-09-16 06:08:34 +02:00
|
|
|
utility appeared in
|
2010-05-13 14:07:55 +02:00
|
|
|
.Nx 1.5 .
|
2016-09-16 06:08:34 +02:00
|
|
|
.Nm
|
|
|
|
utility first appeared in
|
|
|
|
.Fx 5.0 .
|
2010-05-13 14:07:55 +02:00
|
|
|
.Sh AUTHORS
|
|
|
|
.An -nosplit
|
|
|
|
Written by
|
2014-06-20 11:40:43 +02:00
|
|
|
.An Perry E. Metzger Aq Mt perry@piermont.com
|
2010-05-13 14:07:55 +02:00
|
|
|
and
|
2014-06-20 11:40:43 +02:00
|
|
|
.An Matthew R. Green Aq Mt mrg@eterna.com.au .
|
2008-06-09 11:07:58 +02:00
|
|
|
.Sh BUGS
|
|
|
|
The
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql REQUIRE
|
2008-06-09 11:07:58 +02:00
|
|
|
keyword is misleading:
|
2016-09-16 06:08:34 +02:00
|
|
|
It does not describe which daemons have to be running before a script
|
2008-06-09 11:07:58 +02:00
|
|
|
will be started.
|
|
|
|
It describes which scripts must be placed before it in
|
|
|
|
the dependency ordering.
|
|
|
|
For example,
|
|
|
|
if your script has a
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql REQUIRE
|
2008-06-09 11:07:58 +02:00
|
|
|
on
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql sshd ,
|
2012-03-29 07:02:12 +02:00
|
|
|
it means the script must be placed after the
|
2020-06-22 12:01:24 +02:00
|
|
|
.Ql sshd
|
2008-06-09 11:07:58 +02:00
|
|
|
script in the dependency ordering,
|
|
|
|
not necessarily that it requires
|
2020-06-22 12:01:24 +02:00
|
|
|
.Nm sshd
|
2008-06-09 11:07:58 +02:00
|
|
|
to be started or enabled.
|