Debian Codegraph @

man/initctl.8

raw
1 .\" Hey, EMACS: -*- nroff -*-
2 .\" First parameter, NAME, should be all caps
3 .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
4 .\" other parameters are allowed: see man(7), man(1)
5 .Dd July 10, 2025
6 .\" Please adjust this date whenever revising the manpage.
7 .Dt INITCTL 8 SMM
8 .Os Linux
9 .Sh NAME
10 .Nm initctl
11 .Nd Control tool for Finit
12 .Sh SYNOPSIS
13 .Nm /sbin/initctl
14 .Op Fl bcfhjlpqtvV
15 .Op COMMAND
16 .Sh DESCRIPTION
17 .Nm
18 is the official tool for interacting with
19 .Xr finit 8 .
20 It comes with functions for showing status, querying health of services,
21 as well as editing, enabling and disabling services.
22 .Sh OPTIONS
23 This program follows the usual UNIX command line syntax, with long
24 options starting with two dashes (`-'). The options are as follows:
25 .Bl -tag -width Ds
26 .It Fl b, -batch
27 Batch mode, no screen size probing. Useful for scripting
28 .It Fl c, -create
29 Create missing paths (and files) as needed. Useful with the
30 .Cm edit
31 command
32 .It Fl f, -force
33 Ignore missing files and arguments, never prompt
34 .It Fl h, -help
35 Show built-in help text
36 .It Fl j, -json
37 JSON output in
38 .Ar status
39 and
40 .Ar cond
41 commands
42 .It Fl n, -noerr
43 When scripting
44 .Nm
45 to stop, start, restart, or signal a task or service, this option can be
46 used to ignore error 69 (no such task or service) and instead return 0
47 (OK)
48 .It Fl 1, -once
49 Only one lap in commands like top
50 .It Fl p, -plain
51 Use plain table headings, no ANSI control characters
52 .It Fl q, -quiet
53 Silent, only return status of command
54 .It Fl t, -no-heading
55 Skip table headings
56 .It Fl v, -verbose
57 Verbose output, where applicable
58 .It Fl V, -version
59 Show program version
60 .El
61 .Sh COMMANDS
62 .Bl -tag -width Ds
63 .It Nm Ar debug
64 Toggle
65 .Nm finit
66 (daemon) debug to
67 .Pa /dev/console
68 .It Nm Ar help
69 Show built-in help text
70 .It Nm Ar version
71 Show program version
72 .It Nm Ar ls | list
73 List all
74 .Cm *.conf
75 files in
76 .Pa /etc/finit.d
77 .It Nm Ar create Ar CONF
78 Create
79 .Cm .conf
80 in
81 .Pa /etc/finit.d/available .
82 .Pp
83 Piping the contents into
84 .Nm
85 works as one would expect:
86 .Bd -literal -offset indent
87 echo "task name:foo /tmp/foo.sh -- Foo logger" | initctl create foo
88 initctl enable foo
89 initctl reload
90 .Ed
91 .It Nm Ar delete Ar CONF
92 Delete
93 .Cm .conf
94 in
95 .Pa /etc/finit.d/available
96 .It Nm Ar show Ar CONF
97 Show
98 .Cm .conf
99 in
100 .Pa /etc/finit.d/available
101 .It Nm Ar edit Ar CONF
102 Edit
103 .Cm .conf
104 in
105 .Pa /etc/finit.d/available
106 .It Nm Ar touch Ar CONF
107 Change (mark as modified)
108 .Cm .conf
109 in
110 .Pa /etc/finit.d/available ,
111 like
112 .Ar edit
113 this tells
114 .Nm finit
115 that a configuration has been changed and is a candidate to be reloaded
116 (SIGHUP'ed or restarted) on
117 .Cm initctl reload
118 in dependency order
119 .It Nm Ar enable Ar CONF
120 Enable
121 .Cm .conf
122 in
123 .Pa /etc/finit.d/available ,
124 i.e., add symlink in
125 .Pa /etc/finit.d/enabled
126 .It Nm Ar disable Ar CONF
127 Disable
128 .Cm .conf
129 in
130 .Pa /etc/finit.d/enabled ,
131 i.e., removes symlink
132 .It Nm Ar reload
133 Reload all (touched)
134 .Cm *.conf in
135 .Pa /etc/finit.d
136 and activate changes
137 .It Nm Ar cond set Ar COND Op COND ...
138 Set (assert) user-defined condition,
139 .Cm +usr/COND
140 .It Nm Ar cond get Ar COND
141 Get (quietly) the status of any condition. Defaults to user-defined
142 condions, but if a slash is detected, e.g.,
143 .Cm pid/foo
144 or
145 .Cm net/eth0/exist ,
146 then any condition can be read.
147 .Pp
148 The command is geared for scripting, check the exit code to get the
149 status of the condition: 0 - on, 1 - off, 255 - flux. For a more
150 verbose output, use the
151 .Fl v
152 option
153 .It Nm Ar cond clr | clear Ar COND Op COND ...
154 Clear (deassert) user-defined condition,
155 .Cm -usr/COND
156 .It Nm Ar cond status
157 Show condition status, default
158 .Cm cond
159 command. Also supports the
160 .Fl j
161 option for detailed JSON output
162 .It Nm Ar cond dump Op Cm TYPE
163 Dump all, or a given type of, conditions and their status. Also
164 supports the
165 .Fl j
166 option for detailed JSON output
167 .It Nm Ar ident Op Cm NAME
168 Display indentities of all run/task/services, or only instances
169 matching
170 .Cm NAME .
171 A partial string, e.g.,
172 .Cm NAM ,
173 will not match anything
174 .It Nm Ar log Op Cm NAME
175 Show ten last Finit, or
176 .Cm NAME ,
177 messages from syslog
178 .It Nm Ar start Cm NAME[:ID]
179 Start service by name, with optional ID, e.g.,
180 .Cm initctl start tty:1
181 .It Nm Ar stop Cm NAME[:ID]
182 Stop/Pause a running service by name
183 .It Nm Ar reload Cm NAME[:ID]
184 Reload service as if its configuration had changed. Internally,
185 .Nm finit
186 marks the named service as "dirty" and turns the state machine,
187 resulting in a SIGHUP or restart of (at least) the named service.
188 Any dependant services are also restarted.
189 .Pp
190 .Sy Note:
191 no .conf file is reloaded with this variant of the command. Essentially
192 it is the same as calling
193 .Cm restart .
194 Except for two things:
195 .Bl -enum -offset indent -compact
196 .It
197 if the service supports HUP (or has a
198 .Cm reload:script )
199 it is signaled instead of stop-started, and
200 .It
201 it allows restarting run/task in the same runlevel -- which is otherwise
202 restricted
203 .El
204 .It Nm Ar <kill | signal> Cm NAME:[ID] S
205 Send signal S to service, by name.
206 .Cm S
207 may be a complete signal name such as SIGHUP, or short name such as HUP, or the signal number such as 1 (SIGHUP)
208 .It Nm Ar restart Cm NAME[:ID]
209 Restart (stop/start) service by name
210 .It Nm Ar status Cm NAME[:ID]
211 Show service status, by name. If only
212 .Cm NAME
213 is given and multiple instances exits, a summary of all matching
214 instances are shown. Only an exact match displays detailed status
215 for a given instance.
216 .Pp
217 With the
218 .Fl q
219 option this command is silent, provided the
220 .Ar NAME[:ID]
221 selection matches a single run/task/service. The exit code of
222 .Nm
223 is non-zero if there is a problem. Zero is returned if a run/task has
224 run (at least) once in the current runlevel, and when a service is running
225 (as expected). See the
226 .Fl j
227 option for detailed JSON output suitable for machine parsing.
228 .Pp
229 .Sy Tip:
230 .Xr jq 1
231 is a useful scripting tool in combination with JSON output
232 .It Nm Ar status
233 Show status of all services, default command. Also supports the
234 .Fl j
235 option for detailed JSON output
236 .It Nm Ar cgroup
237 List cgroup config overview
238 .It Nm Ar ps
239 List processes based on cgroups
240 .It Nm Ar top
241 Show top-like listing based on cgroups
242 .It Nm Ar plugins
243 List installed plugins
244 .It Nm Ar runlevel Op Ar 0-9
245 Show or set runlevel: 0 halt, 6 reboot.
246 .Pp
247 If called at boot (runlevel S) to set the runlevel, Finit only schedules
248 the change, effectively overriding the configured runlevel from
249 .Pa /etc/finit.conf .
250 Useful to trigger a fail-safe mode, or similar
251 .It Nm Ar reboot
252 Reboot system, default if
253 .Cm reboot
254 is symlinked to
255 .Nm
256 .It Nm Ar halt
257 Halt system, default if
258 .Cm halt
259 is symlinked to
260 .Nm
261 .It Nm Ar poweroff
262 Power-off system, default if
263 .Cm poweroff
264 is symlinked to
265 .Nm
266 .It Nm Ar suspend
267 Suspend system, default if
268 .Cm suspend
269 is symlinked to
270 .Nm
271 .It Nm Ar utmp show
272 Raw dump of UTMP/WTMP db
273 .El
274 .Sh SEE ALSO
275 .Xr finit.conf 5
276 .Xr finit 8
277 .Sh AUTHORS
278 .Nm finit
279 was conceived and reverse engineered by Claudio Matsuoka. Since v1.0,
280 maintained by Joachim Wiberg, with contributions by many others.