| INITCTL(8) | System Manager's Manual (smm) | INITCTL(8) |
NAME¶
initctl — Control
tool for Finit
SYNOPSIS¶
/sbin/initctl |
[-bcfhjlpqtvV] [COMMAND] |
DESCRIPTION¶
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.
OPTIONS¶
This program follows the usual UNIX command line syntax, with long options starting with two dashes (`-'). The options are as follows:
-b,--batch- Batch mode, no screen size probing. Useful for scripting.
-c,--create- Create missing paths (and files) as needed. Useful with the
editcommand. -f,--force- Ignore missing files and arguments, never prompt.
-h,--help- Show built-in help text.
-j,--json- JSON output in status and cond commands.
-n,--noerr- When scripting
initctlto 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- Only one lap in commands like top.
-p,--plain- Use plain table headings, no ANSI control characters.
-q,--quiet- Silent, only return status of command.
-t,--no-heading- Skip table headings.
-v,--verbose- Verbose output, where applicable.
-V,--version- Show program version.
COMMANDS¶
initctldebug- Toggle
finit(daemon) debug to /dev/console initctlhelp- Show built-in help text.
initctlversion- Show program version.
initctlls | list- List all
*.conffiles in /etc/finit.d initctlcreate CONF- Create
.confin /etc/finit.d/available.Piping the contents into
initctlworks as one would expect:echo "task name:foo /tmp/foo.sh -- Foo logger" | initctl create foo initctl enable foo initctl reload
initctldelete CONF- Delete
.confin /etc/finit.d/available initctlshow CONF- Show
.confin /etc/finit.d/available initctledit CONF- Edit
.confin /etc/finit.d/available initctltouch CONF- Change (mark as modified)
.confin /etc/finit.d/available, like edit this tellsfinitthat a configuration has been changed and is a candidate to be restarted (or SIGHUP'ed) oninitctl reload initctlenable CONF- Enable
.confin /etc/finit.d/available, i.e., add symlink in /etc/finit.d/enabled initctldisable CONF- Disable
.confin /etc/finit.d/enabled, i.e., removes symlink. initctlreload- Reload
*.conf in/etc/finit.d, i.e., activates changes. initctlcond set COND [COND ...]- Set (assert) user-defined condition,
+usr/COND initctlcond get COND- Get (quietly) the status of any condition. Defaults to user-defined
condions, but if a slash is detected, e.g.,
pid/fooornet/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
-voption. initctlcond clr | clear COND [COND ...]- Clear (deassert) user-defined condition,
-usr/COND initctlcond status- Show condition status, default
condcommand. Also supports the-joption for detailed JSON output. initctlcond dump [TYPE]- Dump all, or a given type of, conditions and their status. Also supports
the
-joption for detailed JSON output. initctlident [NAME]- Display indentities of all run/task/services, or only instances matching
NAME. A partial string, e.g.,NAM, will not match anything. initctllog [NAME]- Show ten last Finit, or
NAME, messages from syslog. initctlstartNAME[:ID]- Start service by name, with optional ID, e.g.,
initctl start tty:1 initctlstopNAME[:ID]- Stop/Pause a running service by name.
initctlreloadNAME[:ID]- Reload service as if its configuration had changed. Internally,
finitmarks 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:- if the service supports HUP, it's signaled instead of stop-started, and
- it allows restarting run/task in the same runlevel -- which is otherwise restricted.
initctlsignalNAME:[ID] S- Send signal S to service, by name.
Smay be a complete signal name such as SIGHUP, or short name such as HUP, or the signal number such as 1 (SIGHUP). initctlrestartNAME[:ID]- Restart (stop/start) service by name.
initctlstatusNAME[:ID]- Show service status, by name. If only
NAMEis 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
-qoption this command is silent, provided the NAME[:ID] selection matches a single run/task/service. The exit code ofinitctlis 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-joption for detailed JSON output suitable for machine parsing.Tip: jq(1) is a useful scripting tool in combination with JSON output.
initctlstatus- Show status of all services, default command. Also supports the
-joption for detailed JSON output. initctlcgroup- List cgroup config overview.
initctlps- List processes based on cgroups.
initctltop- Show top-like listing based on cgroups.
initctlplugins- List installed plugins.
initctlrunlevel [0-9]- Show or set runlevel: 0 halt, 6 reboot.
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.
initctlreboot- Reboot system, default if
rebootis symlinked toinitctl. initctlhalt- Halt system, default if
haltis symlinked toinitctl. initctlpoweroff- Power-off system, default if
poweroffis symlinked toinitctl. initctlsuspend- Suspend system, default if
suspendis symlinked toinitctl. initctlutmp show- Raw dump of UTMP/WTMP db.
SEE ALSO¶
AUTHORS¶
finit was conceived and reverse engineered
by Claudio Matsuoka. Since v1.0, maintained by Joachim Wiberg, with
contributions by many others.
| June 6, 2021 | Linux |