aboutsummaryrefslogtreecommitdiffstats
path: root/doc/s6_system.html
blob: 63055f89a66bd5b409a3881fd56944c56f148a77 (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
<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-frontend: the s6 system command</title>
    <meta name="Description" content="s6-frontend: the s6 system command" />
    <meta name="Keywords" content="s6 ecosystem supervision service manager user interface init skarnet.org skarnet software boot shutdown system reboot poweroff" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

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

<h1> The <tt>s6 system</tt> command </h1>

<p>
 <tt>s6 system</tt> regroups actions related to booting or shutting down
the system.
</p>

<h2 id="interface"> Interface </h2>

<pre>
     s6 system <em>subcommand</em>
</pre>

<ul>
 <li> No subcommand takes any options. </li>
</ul>

<h2 id="subcommands"> Subcommands </h2>

<h3 id="help"> help </h3>

<p>
 <tt>s6 system help</tt> prints a short help message summarizing the options
and usage of the <tt>s6 system</tt> command. It is not as detailed as this page.
</p>

<h3 id="boot"> boot </h3>

<h4> Interface </h4>

<pre>
     s6 system boot
</pre>

<ul>
 <li> <tt>s6 system boot</tt> initializes the live directory for s6-rc
then starts all the services defined in the default bundle. In other
words, it brings the system from a state where nothing is running to
a state where everything the user wants is running. </li>
 <li> This is the command that should be called as soon as the init
program hands off duties.
  <ul>
   <li> On a system making use of
<a href="//skarnet.org/software/s6-linux-init/">s6-linux-init</a>,
<tt>s6 system boot</tt> should be run by the
<tt>/etc/rc.init</tt> script. No other command needs to appear in
that script. </li>
   <li> On a system using <tt>/etc/inittab</tt>, you need to add
two lines at the beginning of <tt>/etc/inittab</tt>:
    <ul>
     <li> The first line should be a command that runs and respawns
<a href="//skarnet.org/software/s6/s6-svscan.html">s6-svscan</a>,
ideally with a catch-all logger. This could be something like
<tt>::respawn:/usr/lib/s6/s6-svscanboot</tt>, with <tt>/usr/lib/s6/s6-svscanboot</tt>
being similar to the script used
<a href="https://gitlab.alpinelinux.org/alpine/aports/-/blob/master/main/s6/s6-svscanboot?ref_type=heads">in
Alpine Linux</a> to start an instance of s6-svscan supervising its own
catch-all logger. </li>
     <li> The second line should be <tt>::wait:/usr/bin/s6 system boot</tt>. </li>
     <li> For complete safety, there should be a synchronization mechanism so
that the second line never starts before s6-svscan is ready. A quick and (very) dirty
way to synchronize is polling on s6-svscan before running the
command: <tt>::wait:until s6-svscanctl /run/service 2&gt;/dev/null; do :; done &amp;&amp; exec /usr/bin/s6 system boot</tt> </li>
    </ul> </li>
 <li> It is also possible to run a complete s6 ecosystem under systemd, but it is redundant,
so it's unlikely that anyone would want to do it. For the sake of completeness,
the way would be to define two unit files: the first one to launch s6-svscan, as
documented <a href="//skarnet.org/software/s6/s6-svscan-not-1.html">here</a>,
and the second one, specified to run <em>after</em> the first one, to run
the <tt>s6 system boot</tt> command as a one-shot. </li>
  </ul> </li>
</ul>

<p>
 The rest of the subcommands are shutdown subcommands, and they
only work if the machine makes use of
<a href="//skarnet.org/software/s6-linux-init/">s6-linux-init</a> and
s6-frontend has been configured to support it. On a machine that
does not boot via s6-linux-init, a shutdown should be executed via
the shutdown commands provided by your init system. In order for
the shutdown to be clean, the <code>s6 live stop-everything -E</code>
should be run before the init system performs a hard shutdown. For
instance, if the system uses <tt>/etc/inittab</tt>, then the
following line should appear in <tt>/etc/inittab</tt>:
<code>::shutdown:/usr/bin/s6 live stop-everything -E</code>
</p>

<h3 id="reboot"> reboot </h3>

<h4> Interface </h4>

<pre>
     s6 system reboot
</pre>

<ul>
 <li> <tt>s6 system reboot</tt> reboots the machine.
 <li> This only works if the machine makes use of
<a href="//skarnet.org/software/s6-linux-init/">s6-linux-init</a> and
s6-frontend has been configured to support it. </li>
</ul>

<h3 id="poweroff"> poweroff </h3>

<h4> Interface </h4>

<pre>
     s6 system poweroff
</pre>

<ul>
 <li> <tt>s6 system poweroff</tt> halts the system and turns the
power off. </li>
 <li> This only works if the machine makes use of
<a href="//skarnet.org/software/s6-linux-init/">s6-linux-init</a> and
s6-frontend has been configured to support it. </li>
</ul>

<h3 id="halt"> halt </h3>

<h4> Interface </h4>

<pre>
     s6 system halt
</pre>

<ul>
 <li> <tt>s6 system halt</tt> halts the system without turning
the power off. </li>
 <li> This only works if the machine makes use of
<a href="//skarnet.org/software/s6-linux-init/">s6-linux-init</a> and
s6-frontend has been configured to support it. </li>
</ul>

</body>
</html>