summaryrefslogtreecommitdiff
path: root/doc/s6-rc-db.html
blob: bc527a6a582088ac92c1907f2d8475328d9297ff (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
<html>
  <head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="Content-Language" content="en" />
    <title>s6-rc: the s6-rc-db program</title>
    <meta name="Description" content="s6-rc: the s6-rc-db program" />
    <meta name="Keywords" content="s6-rc offline database dump command rc init dependency state management services" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

<p>
<a href="index.html">s6-rc</a><br />
<a href="//skarnet.org/software/">Software</a><br />
<a href="//skarnet.org/">skarnet.org</a>
</p>

<h1> The s6-rc-db program </h1>

<p>
 s6-rc-db is a tool to analyze a compiled service database
and extract information from it, and print it in a user-friendly
format.
</p>

<p>
 It is an <em>offline tool</em>, i.e. you can run it on any
compiled service database without actually having a live set
of services managed by s6-rc. However, if you do have a live
set, you can still run s6-rc-db on the current database (and
it is the default); it won't interfere with your normal service
operation.
</p>

<h2> Interface </h2>

<pre>
     s6-rc-db help
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] check
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] list all|services|oneshots|longruns|bundles
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] type <em>servicename</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] [ -u | -d ] timeout <em>atomicname</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] contents <em>bundlename</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] [ -u | -d ] dependencies <em>servicename</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] pipeline <em>longrunname</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] [ -u | -d ] script <em>oneshotname</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] flags <em>atomicname</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] atomics <em>servicename...</em>
     s6-rc-db [ -l <em>live</em> ] [ -c <em>compiled</em> ] [ -b ] [ -u | -d ] all-dependencies <em>servicename...</em>
</pre>

<ul>
 <li> s6-rc-db expects to find a <em>compiled service database</em>
in <em>compiled</em>; by default it uses the service database
used by the live state in <em>live</em>.
It reads and parses the compiled database it finds; depending on
its arguments, it prints the requested
information to stdout, then exits 0. </li>
</ul>

<h2> Options </h2>

<ul>
 <li> <tt>-c&nbsp;<em>compiled</em></tt>&nbsp;: examine a
compiled service database in <em>compiled</em> instead of
the current live one. </li>
 <li> <tt>-l&nbsp;<em>live</em></tt>&nbsp;: assume the live
state is in <em>live</em>. This option is ignored if the
<tt>-c</tt> option has been given. Default is
<tt>/run/s6-rc</tt>. The default can be changed at package
compilation time, by giving the <tt>--livedir=<em>live</em></tt>
option to <tt>./configure</tt>. </li>
 <li> <tt>-u</tt>&nbsp;: for commands that use different data
depending on whether it's about bringing the service up or down,
select the "up" data (this is the default). This option is
ignored when it is irrelevant. </li>
 <li> <tt>-d</tt>&nbsp;: for commands that use different data
depending on whether it's about bringing the service up or down,
select the "down" data. This option is ignored when it is irrelevant. </li>
 <li> <tt>-b</tt>&nbsp;: blocking lock. If the database is currently
being used by another program, s6-rc-db will wait until that
other program has released its lock on the database, then proceed.
By default, s6-rc-db fails with an error message if the database
is currently in use. </li>
</ul>

<h2> Exit codes </h2>

<ul>
 <li> 0: success </li>
 <li> 3: identifier not found in service database </li>
 <li> 4: invalid or corrupted service database </li>
 <li> 5: wrong identifier type for the given command </li>
 <li> 100: wrong usage </li>
 <li> 111: system call failed </li>
</ul>

<h2> Subcommands </h2>

<h3> s6-rc-db help </h3>

<p>
 Prints a help message on stdout.
</p>

<h3> s6-rc-db check </h3>

<p>
 Checks the database consistency. Exits 4 with an error message if
it finds a problem, such as a mismatch in the direct and reverse
dependency tables, or a dependency cycle.
</p>

<h3> s6-rc-db list </h3>

<p>
 Lists all services of a given type. This subcommand takes a second subcommand:
</p>

<h4> s6-rc-db list all </h4>

<p>
 Lists everything - atomic services and bundles - contained in the database.
</p>

<h4> s6-rc-db list services </h4>

<p>
 Lists all atomic services.
</p>

<h4> s6-rc-db list oneshots </h4>

<p>
 Lists oneshots.
</p>

<h4> s6-rc-db list longruns </h4>

<p>
 Lists longruns.
</p>

<h4> s6-rc-db list bundles </h4>

<p>
 Lists all bundles.
</p>

<h3> s6-rc-db type <em>servicename</em> </h3>

<p>
 Prints the type of <em>servicename</em>: <tt>oneshot</tt>, <tt>longrun</tt>
or <tt>bundle</tt>.
</p>

<h3> s6-rc-db timeout <em>atomicname</em> </h3>

<p>
 Prints the timeout value, in milliseconds, after which bringing
<em>atomicname</em> up or down is considered a failure if the
called script still has not succeeded.
By default, or if the <tt>-u</tt>
option has been given to s6-rc-db, the timeout for <em>up</em> is
printed; the timeout for <em>down</em> is printed instead if the
<tt>-d</tt> option has been given.
</p>

<h3> s6-rc-db contents <em>bundlename</em> </h3>

<p>
 Lists the atomic services represented by bundle <em>bundlename</em>.
</p>

<h3> s6-rc-db dependencies <em>servicename</em> </h3>

<p>
 Prints the list of direct dependencies for <em>servicename</em>. If
<em>servicename</em> is a bundle, its set of direct dependencies
is the union of the direct dependencies of all the atomic services
contained in the bundle.
</p>

<p>
 If the <tt>-d</tt> option has been given to s6-rc-db, the
reverse dependencies are given instead: services that directly
depend on <em>servicename</em>, or on one of its components if it
is a bundle.
</p>

<h3> s6-rc-db pipeline <em>longrunname</em> </h3>

<p>
 Prints the longrun service pipeline <em>longrunname</em> is a
part of, one service per line, producers before consumers.
If <em>longrunname</em> isn't
part of a pipeline, only <em>longrunname</em> is printed.
</p>

<h3> s6-rc-db script <em>oneshotname</em> </h3>

<p>
 Prints the <em>up</em> script for <em>oneshotname</em>, which is
an <em>argv</em>, i.e. a Unix command line. Each component of this
command line is
<strong>terminated by a null character</strong>, so to print it in
a human-readable format, pipe the output into something like
<tt>xargs -0 echo</tt>.
</p>

<p>
 If the <tt>-d</tt> option has been given to s6-rc-db, the
<em>down</em> script is printed instead.
</p>

<h3> s6-rc-db flags <em>atomicname</em> </h3>

<p>
 Prints a hexadecimal number that is the list of all binary flags
for atomic service <em>atomicname</em>.
</p>

<p>
 Those binary flags are currently unused, but this may change in a
future version of s6-rc.
</p>

<h3> s6-rc-db atomics <em>servicename...</em> </h3>

<p>
 Prints the fully resolved list of services represented by the
<em>servicename...</em> arguments, i.e. the union of all
atomic services contained in <em>servicename...</em>. Each
argument in <em>servicename...</em> can be an atomic service or
a bundle.
</p>

<h3> s6-rc-db all-dependencies <em>servicename...</em> </h3>

<p>
 Prints the list of all atomic services needed to bring up
all of the <em>servicename...</em> arguments, with all their
dependencies, recursively. In other words: for
<em>servicename...</em> to be up, every single service listed
in the output will need to be up. The output includes the
atomic services represented by the
<em>servicename...</em> arguments themselves.
</p>

<p>
 The list is not topologically sorted.
</p>

<p>
 If the <tt>-d</tt> option has been given to s6-rc-db, the
recursive list of reverse dependencies is printed: for
<em>servicename...</em> to be down, every single service listed
in the output will need to be down.
</p>

</body>
</html>