Also changes the default to set $HOME to / instead of nothing. This can
of course be improved immensely. Pull requests always welcome ;-)
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch removes the now heavily outdated (and non-working) support
for callback plugins. I.e. plugins that attach themselves to services
listed in /etc/finit.conf and can be queried to determine if a service
should be started or stopped.
The Finit3 support for adding/removing services at runtime with plain
text *.conf files in /etc/finit.d and `initctl reload`, this old, and
rather cumbersome service callback feature, is not longer supported.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Add support for registering callbacks to be called after a given
timeout.
Use this to implement forceful termination of services that refuse to
terminate upon receiving a SIGTERM. If the service PID is not collected
within 3 seconds, send a SIGKILL to it.
Also, rework restarting of crashing services. When a service crashes for
the first time, try to restart it immediately. If it crashes again, wait
a few seconds before trying again. Just as before, if it continues to
crash, block the service.
This patch prevents double critical/error messages from being printed on
the console when there is no syslog daemon running yet.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Delay setup of initctl plugin to after the base filesystems are up and
after the bootmisc plugin has run.
This patch factors out the I/O initialization of plugins so it does not
have to run when plugins are loaded. Instead, plugins can now call this
API to register an I/O callback when they are ready.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
In UTMP a terminating zero in string fields is optional, so we need to
take that into account when preparing entrys.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch makes Finit require libuEv v1.4.2, a minor bugfix update, and
libite (-lite) v1.8.2, which is quite a bit more than just a few bug
fixes. The most relevant fixes are the removal of implicit logging for
touch(), makedir(), makefifo(), and erase() inline functions. The
release also removed implicit logging to stderr on error, as well as a
a few build fixes for running on musl libc.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch adds a very special debug mode to Finit. With this feature
enabled the actual duties of PID 1 is forked off early to a child. If
that child ever dies, usually due to a SIGSEGV, this wakes up the real
PID 1 which lauches a debug shell on the console.
Remember to disable 'quiet' and enable '--debug' on the kernel command
line to get all the debug logs -- which these days goes into the kernel
log in /dev/kmsg -- simply `cat /dev/kmsg` and use Ctrl-C to get the
shell prompt back.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Very early, before syslogd has started, we have traditionally been
forced to use stdout/stderr for debug, warning and error messages.
With this patch we can now rely on /dev/kmsg to preserve all logs
from early Finit problems. When syslogd/klogd starts up they read
/dev/kmsg and copy logs to /var/log/* files.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Refactor getent() for improved separation and readability
- Warn and exit if /etc/protocols or /etc/services is missing
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
Adjust debug levels slightly and add _w() macro for LOG_WARNING,
useful when having /dev/kmsg as backend. The latter outputs any
log <= LOG_ERR to console as well.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This patch fixes a build problem when configured without inetd support.
Signed-off-by: Markus Svilans <msvilans@aeonyx.ca>
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
- Add support for SysV init setenv to activate poweroff
- Update help text considerably to be more helpful
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
The UTMP db tracks currently logged in users and WTMP is an audit trail
of all user logins and logouts, as well as runlevel changes and reboot.
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>