blob: 6b82bd53d1f4667a7ca1fabc641566052a0e00fd (
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
|
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta http-equiv="Content-Language" content="en" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>prepare-svscan</title>
<meta name="Description" content="Helper script to initialize a supervision tree." />
<meta name="Keywords" content="goetia s6 s6-rc supervision tree" />
</head>
<header>
<p>
<a href="//0x53.net/software/goetia/goetia-base">goetia-base</a>
<br />
<a href="//0x53.net/software/goetia">goetia</a>
<br />
<a href="//0x53.net/software">Software</a>
<br />
<a href="//0x53.net">0x53.net</a>
</p>
</header>
<body>
<h1>The prepare-svscan program</h1>
<p>
prepare-svscan does generic preparation of the
<a href="//0x53.net/software/goetia/supervisiontree.html">supervision tree</a>.
It is also used in system-init and
<a href="./user-init.html">user-init</a>.
</p>
<h2>Interface</h2>
<pre> prepare-svscan <em>workingdir</em> <em>rundir</em> <em>bundle</em> <em>prog...</em></pre>
<ul>
<li>
prepare-svscan sets its standard input to <code>/dev/null</code>.
</li>
<li>
It sets the umask to <code>0022</code>.
</li>
<li>
It creates the directory <code><em>rundir</em></code>.
</li>
<li>
It copies all contents of <code><em>workingdir</em>/run-image/.</code>
to <code><em>rundir</em>/</code>.
</li>
<li>
It changes its standard output to <code><em>rundir</em>/service/s6-svscan-log/fifo</code>.
</li>
<li>
prepare-svscan then forks a background process that:
<ul>
<li>
waits for a reading end at <code><em>rundir</em>/service/s6-svscan-log/fifo</code>.
</li>
<li>
Once the above is given, if <code><em>rundir</em>/s6-rc</code> does <em>not</em> exist,
</li>
<li>
it initiates <a href="https://skarnet.org/software/s6-rc/">s6-rc</a> on
<code><em>rundir</em>/service</code> using
<a href="https://skarnet.org/software/s6-rc/s6-rc-init.html">s6-rc-init</a>
and starts the bundle <code><em>bundle</em></code> using s6-rc.
</li>
</ul>
</li>
<li>
It copies stderr to stdout.
</li>
<li>
If available, the directory <code><em>workingdir</em>/env</code> is sourced using
<a href="https://skarnet.org/software/s6/s6-envdir.html">s6-env</a>.
</li>
<li>
prepare-svscan executest into <code><em>prog...</em></code>,
which is usually directly or indirectly
<a href="https://skarnet.org/software/s6/s6-svscan.html">s6-svscan</a>.
</li>
</ul>
<p>
Once s6-svscan is launched it will start an
<a href="https://skarnet.org/software/s6/s6-supervise.html">s6-supervise</a>
process on <code><em>rundir</em>/service/s6-svscan-log</code> which starts
<a href="https://skarnet.org/software/s6/s6-log.html">s6-log</a> reading
from <code><em>rundir</em>/service/s6-svscan-log/fifo</code>.
This in turn triggers the forked background process to continue with its second step.
</p>
<h2>Exit codes</h2>
<ul>
<li>
prepare-svscan usually executes into
<a href="https://skarnet.org/software/s6/s6-svscan.html">s6-svscan</a>
which exits according to its page.
</li>
<li>
Since prepare-svscan is an
<a href="https://skarnet.org/software/execline/">execline</a>
script, it exits with an approximation
of employed program that failed.
</li>
<li>
prepare-svscan mostly uses
<a href="https://skarnet.org/software/execline/">execline</a>
and
<a href="https://skarnet.org/software/s6/">s6</a>
software, the exit behaviour of which can be looked up on
their respective pages.
</li>
<li>
See also:
<a href="https://skarnet.org/software/execline/exitcodes.html">execline exit code handling</a>.
</li>
</ul>
<h2>Options</h2>
<ul>
<li>
There are no otions to prepare-svscan.
</li>
</ul>
</body>
</html>
|