This change opens up the runlevel change API from bootstrap. The twist
is that the change is only queued, i.e., the call `initctl runlevel 9`
during bootstrap only changes the configured runlevel to go to after
bootstrap has completed.
Effectively, this change allows overriding the `runlevel` directive in
/etc/finit.conf without having to change the file.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This should clarify the messup on the behalf of the mainatiner in not
documenting this properly, including the deviations introduced in v4.4
See issue #359 for a background.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This change adds very basic tmpfiles.d/ support to Finit. Much of the
basic types are supported, but not all, so for now, please check the
code for details on what is working.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
The accepted standard in Unix is to report successful executions with
exitcode 0. Therefore, map a "initctl cond get" of a condition to the
following exitcodes:
- On: 0
- Off: 1
- Flux: 255
Fixes: c3c662fe64 ("initctl: ensure 'cond get' support flux state")
Signed-off-by: Tobias Waldekranz <tobias@waldekranz.com>
The 'initctl cond' commands were initiallý added to only manage usr
conditions. Recently the 'cond get' command was expanded to allow
reading general conditions as well.
However, since general conditions support three states the command
returned 'on' for conditions that were in flux. This patch fixes
that oversight.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This change makes it possible to use the standard continuation character
in .conf files. For example:
service [23456] \
log:stderr \
<!pid/foo> \
bar \
-- This is the bar service, it depends on foo # comment that's dropped
Notice the additional support for comments on .conf lines. If you use
the comment character today you must change to escape it. Like this:
service :2 foo -- Foo \#2
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch adds the oncrash:script option to call the post:script
action, if defined, for a crashing service. The EXIT_CODE variable
sent to the script is set to `crashed`.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Allow filtering of conditions in raw dump, i.e., the possibility to show
only conditions of a certain type. The TYPE argument is not validated
in any way, so any prefix match is allowed, e.g.
initctl cond dump service/s
Shows all conditions for services starting with 's'.
Fixes issue #272
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This change allows endless restarts, similar to `respawn` but honors
`restart_sec`. There is no upper limit on the number of times Finit
tries to restart a crashing service. Same as `restart:-1`
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
What a ride, apparently we support restarting run/tasks in the same
runlevel they have already started once in. Still unsure if adding
support for reloading a particular Finit .conf file for a service
should be in the context of this command (it isn't now). Maybe it
is better left as a future expansion when we switch to the new .conf
format?
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This adds support for bringing up the system with an alternate fstab at
boot. E.g., when using a primary/secondary setup for boot partitions.
By default /etc/fstab is read, like before, this can now be changed
using configure --with-fstab=/path/to/fstab.primary, which sets the
default that can be overridden using finit.fstab=/etc/fstab.secondary
If mounting, or fsck, fails in any way, Finit calls its own bundled
sulogin, or the system sulogin(8), to let the user handle the issue.
If there is no sulogin available, Finit will try to start up in its
rescue.conf boot mode.
Please note, in either of these rescue modes, use `reboot -f` to get the
system to reboot. Finit is on pause in the background in rescue mode
and cannot be relied on (since there may not be any writable filesystems
available.).
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
Usability.
Remains backwards compatible for now, but finit.show_status is as of 4.3
deprecated. Likely to be removed int 5.0
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
- Add `type:forking` service option to trigger guessing pidfile to
watch for, instead of `pid:!foo` option, which is not intuitive.
This option may likely also survive into the new file format :)
- Update docs and add examples
- Update start-stop-serv.sh test case with this new variant
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This patch adds the -v,--version option to initctl, which acts as an
alias to the 'version' command. For now they end up in the same old
function, printing the program version. However, in time this will be
changed so that the 'version' command asks a running Finit for its
version instead of assuming the daemon is of the same version.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
As suggested in issue #197, this new command: 'initctl id [NAME]'
lists identities of all, or named, services. E.g,
# initctl id telnetd
telnetd:23
telnetd:2323
The NAME argument is optional, when omitted it lists all enabled
run/task/sysv/service in the system, with their full name, and any
optional identitty. E.g.
# initctl id
dropbear
tty:console
mdnsd
mini-snmpd
smcrouted
sntpd
ssdpd
sysklogd
watchdogd
httpd
telnetd:23
telnetd:2323
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
When the system has multiple services 'foo' the initctl command
'status foo' should give a focused overview of all matching foo:*,
whereas a 'status foo:2' should show the detailed view of that
particular instance.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>