summaryrefslogtreecommitdiff
path: root/doc/s6-linux-init-telinit.html
blob: 2bea4e515a5419f6e9c404de1af62802a234492e (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
<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-linux-init: the s6-linux-init-telinit program</title>
    <meta name="Description" content="s6-linux-init: the s6-linux-init-telinit program" />
    <meta name="Keywords" content="s6 linux init administration root utilities telinit" />
    <!-- <link rel="stylesheet" type="text/css" href="//skarnet.org/default.css" /> -->
  </head>
<body>

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

<h1> The <tt>s6-linux-init-telinit</tt> program </h1>

<p>
<tt>s6-linux-init-telinit</tt> changes runlevels, i.e. changes the
system state. It is normally invoked as <tt>/sbin/telinit</tt> or
just <tt>init</tt> with an argument.
</p>

<h2> Interface </h2>

<pre>
     s6-linux-init-telinit <tt>rl</tt>
</pre>

<ul>
 <li> <tt>s6-linux-init-telinit</tt> may be called with the same options as
<tt>s6-linux-init</tt>, but it ignores them all. </li>
 <li> It calls the runleveld
<a href="//skarnet.org/software/s6/localservice.html">local service</a> with
the <em>rl</em> argument. This local service executes the user-provided
<tt>runlevel</tt> script, which changes the system state to the state
described by <em>rl</em>. </li>
 <li> As a special case, if <em>rl</em> is <tt>0</tt> or <tt>6</tt>,
<tt>s6-linux-init-telinit</tt> then executes into
<a href="s6-linux-init-hpr.html">s6-linux-init-hpr</a> with the <tt>-p</tt>
or <tt>-r</tt> option respectively,
for compatibility with sysvinit's <em>0</em> and <em>6</em> runlevels
that respectively halt and reboot the machine. </li>
</ul>

<h2> Exit codes </h2>

<ul>
 <li> 100: wrong usage </li>
 <li> 111: system call failed </li>
 <li> Else, <tt>s6-linux-init-telinit</tt> exits with the same exit code
as the <em>runlevel</em> script called with the <em>rl</em> argument. </li>
 <li> If <em>rl</em> is 0 or 6, in case of success
<tt>s6-linux-init-telinit</tt> exits 0, but the system shuts down
immediately as it returns. </li>
</ul>

<h2> Notes </h2>

<ul>
 <li> Traditional sysvinit only allows integer runlevels, from 0 to 6.
More advanced service managers, like OpenRC or s6-rc, allow the admin to
define alphanumerical runlevels, or <em>states</em>. <tt>s6-linux-init-telinit</tt>
does not implement policy; it only makes sure the user-provided <tt>runlevel</tt>
script is called with the <em>rl</em> argument, under a safe and reproducible
environment. The <tt>runlevel</tt> script can then change the machine state
as chosen by the user - typically by invoking the service manager. </li>
 <li> The <tt>0</tt> and <tt>6</tt> special case has been added because
some legacy programs may assume that calling <tt>init 0</tt> and <tt>init 6</tt>
respectively halt and reboot the system. </li>
 <li> The <tt>s6-linux-init-telinit</tt>
binary is not meant to be called directly by administrators. Instead, after a
<a href="s6-linux-init-maker.html">s6-linux-init-maker</a> invocation,
the <tt>bin/</tt> subdirectory of the target will contain a <tt>telinit</tt>
symlink to <tt>s6-linux-init-telinit</tt>. The <tt>bin/</tt> subdirectory
should be copied by the administrator into <tt>/sbin</tt> for full
interface compatibility with sysvinit. </li>
</ul>

</body>
</html>