| INITCTL(8) | System Manager's Manual (smm) | INITCTL(8) |
initctl — Control
tool for Finit
/sbin/initctl |
[-bcfhjlpqtvV] [COMMAND] |
initctl is the official tool for
interacting with finit(8). It comes with functions for
showing status, querying health of services, as well as editing, enabling
and disabling services.
This program follows the usual UNIX command line syntax, with long options starting with two dashes (`-'). The options are as follows:
-b,
--batch-c,
--createedit command.-f,
--force-h,
--help-j,
--json-n,
--noerrinitctl to stop, start, restart, or
signal a task or service, this option can be used to ignore error 69 (no
such task or service) and instead return 0 (OK).-1,
--once-p,
--plain-q,
--quiet-t,
--no-heading-v,
--verbose-V,
--versioninitctl debugfinit (daemon) debug to
/dev/consoleinitctl helpinitctl versioninitctl ls |
list*.conf files in
/etc/finit.dinitctl create
CONF.conf in
/etc/finit.d/available.
Piping the contents into initctl works
as one would expect:
echo "task name:foo /tmp/foo.sh -- Foo logger" | initctl create foo initctl enable foo initctl reload
initctl delete
CONF.conf in
/etc/finit.d/availableinitctl show
CONF.conf in
/etc/finit.d/availableinitctl edit
CONF.conf in
/etc/finit.d/availableinitctl touch
CONF.conf in
/etc/finit.d/available, like
edit this tells finit that a
configuration has been changed and is a candidate to be restarted (or
SIGHUP'ed) on initctl reloadinitctl enable
CONF.conf in
/etc/finit.d/available, i.e., add symlink in
/etc/finit.d/enabledinitctl disable
CONF.conf in
/etc/finit.d/enabled, i.e., removes symlink.initctl reload*.conf in
/etc/finit.d, i.e., activates changes.initctl cond set
COND [COND ...]+usr/CONDinitctl cond get
CONDpid/foo or net/eth0/exist,
then any condition can be read.
The command is geared for scripting, check the exit code to
get the status of the condition: 0 - on, 1 - off, 255 - flux. For a more
verbose output, use the -v option.
initctl cond clr |
clear COND [COND ...]-usr/CONDinitctl cond statuscond command. Also
supports the -j option for detailed JSON
output.initctl cond dump
[TYPE]-j option for detailed JSON output.initctl ident
[NAME]NAME. A partial string, e.g.,
NAM, will not match anything.initctl log
[NAME]NAME, messages from
syslog.initctl start
NAME[:ID]initctl
start tty:1initctl stop
NAME[:ID]initctl reload
NAME[:ID]finit marks the named service as "dirty"
and turns the state machine, resulting in a SIGHUP or restart of (at
least) the named service. Any dependant services are also restarted.
Note:
no .conf file is reloaded with this variant of the command. Essentially
it is the same as calling restart. Except for
two things:
initctl signal
NAME:[ID] SS may be a
complete signal name such as SIGHUP, or short name such as HUP, or the
signal number such as 1 (SIGHUP).initctl restart
NAME[:ID]initctl status
NAME[:ID]NAME is
given and multiple instances exits, a summary of all matching instances
are shown. Only an exact match displays detailed status for a given
instance.
With the -q option this command is
silent, provided the NAME[:ID] selection matches a
single run/task/service. The exit code of
initctl is non-zero if there is a problem. Zero
is returned if a run/task has run (at least) once in the current
runlevel, and when a service is running (as expected). See the
-j option for detailed JSON output suitable for
machine parsing.
Tip: jq(1) is a useful scripting tool in combination with JSON output.
initctl status-j option for detailed JSON output.initctl cgroupinitctl psinitctl topinitctl pluginsinitctl runlevel
[0-9]If called at boot (runlevel S) to set the runlevel, Finit only schedules the change, effectively overriding the configured runlevel from /etc/finit.conf. Useful to trigger a fail-safe mode, or similar.
initctl rebootreboot is symlinked to
initctl.initctl halthalt is symlinked to
initctl.initctl poweroffpoweroff is symlinked
to initctl.initctl suspendsuspend is symlinked to
initctl.initctl utmp showfinit was conceived and reverse engineered
by Claudio Matsuoka. Since v1.0, maintained by Joachim Wiberg, with
contributions by many others.
| June 6, 2021 | Linux |