.\"
.TP
\fBno\-sigterm\fR
-specifies that the TERM signal should not be send to the process to terminate
+Specifies that the TERM signal should not be send to the process to terminate
it. (Another signal can be specified using the \fBtermsignal\fR setting; if no
other signal is specified, no signal will be sent, which usually means that
the service will not terminate).
.TP
\fBruns\-on\-console\fR
-specifies that this service uses the console; its input and output should be
+Specifies that this service uses the console; its input and output should be
directed to the console (or precisely, to the device to which Dinit's standard
output stream is connected). A service running on the console prevents other
services from running on the console (they will queue for the console).
the service process, but typically will cause it to terminate.
.TP
\fBstarts\-on\-console\fR
-specifies that this service uses the console during service startup. This is
+Specifies that this service uses the console during service startup. This is
implied by \fBruns-on-console\fR, but can be specified separately for services
that need the console while they start but not afterwards.
useful to allow filesystem checks to be interrupted/skipped.
.TP
\fBstarts-rwfs\fR
-this service mounts the root filesystem read/write (or at least mounts the
+This service mounts the root filesystem read/write (or at least mounts the
normal writable filesystems for the system). This prompts Dinit to create its
control socket, if it has not already managed to do so.
.TP
\fBstarts-log\fR
-this service starts the system log daemon. Dinit will begin logging via the
+This service starts the system log daemon. Dinit will begin logging via the
\fI/dev/log\fR socket.
.TP
\fBpass-cs-fd\fR
-pass an open Dinit control socket to the process when launching it (the
+Pass an open Dinit control socket to the process when launching it (the
\fIDINIT_CS_FD\fR environment variable will be set to the file descriptor of
the socket). This allows the service to issue commands to Dinit even if the
regular control socket is not available yet.
control socket.
.TP
\fBstart-interruptible\fR
-this service can have its startup interrupted (cancelled) if it becomes inactive
+This service can have its startup interrupted (cancelled) if it becomes inactive
while still starting, by sending it the SIGINT signal. This is meaningful only
for \fBbgprocess\fR and \fBscripted\fR services.
+.TP
+\fBskippable\fR
+For scripted services, indicates that if the service startup process terminates
+via an interrupt signal (SIGINT), then the service should be considered started.
+Note that if the interrupt was issued by Dinit to cancel startup, the service
+will instead be considered stopped.
.RE
.LP
The next section contains example service descriptions including some of the
system, but the control socket may not have been created, so it uses the
\fBpass-cs-fd\fR option to allow the \fBreboot\fR command to issue control
commands to Dinit. It runs on the console, so that output is visible and
-the process can be interrupted using control-C.
+the process can be interrupted using control-C, in which case the check is
+skipped but dependent services continue to start.
.RS
.nf
type = scripted
command = /etc/dinit.d/rootfscheck.sh
restart = false
-options = starts-on-console pass-cs-fd
+options = starts-on-console pass-cs-fd start-interruptible skippable
depends-on = early-filesystems # /proc and /dev
depends-on = device-node-daemon
.ft
*/
struct onstart_flags_t {
+ // on-start flags:
bool rw_ready : 1; // file system should be writable once this service starts
bool log_ready : 1; // syslog should be available once this service starts
- // Not actually "onstart" commands:
+ // Other service options flags:
bool no_sigterm : 1; // do not send SIGTERM
bool runs_on_console : 1; // run "in the foreground"
bool starts_on_console : 1; // starts in the foreground
bool pass_cs_fd : 1; // pass this service a control socket connection via fd
+ bool skippable : 1; // if interrupted the service is skipped (scripted services)
onstart_flags_t() noexcept : rw_ready(false), log_ready(false),
- no_sigterm(false), runs_on_console(false), starts_on_console(false), pass_cs_fd(false)
+ no_sigterm(false), runs_on_console(false), starts_on_console(false),
+ pass_cs_fd(false), skippable(false)
{
}
};
bool restarting : 1; // re-starting after unexpected termination
bool start_failed : 1; // failed to start (reset when begins starting)
+ bool start_skipped : 1; // start was skipped by interrupt
int required_by = 0; // number of dependents wanting this service to be started
waiting_for_console(false), have_console(false), waiting_for_execstat(false),
start_explicit(false), prop_require(false), prop_release(false), prop_failure(false),
prop_start(false), prop_stop(false), restarting(false), start_failed(false),
- force_stop(false)
+ start_skipped(false), force_stop(false)
{
services = set;
service_name = name;
// commence starting/stopping.
void unpin() noexcept;
+ // Is this a dummy service (used only when loading a new service)?
bool is_dummy() noexcept
{
return record_type == service_type_t::DUMMY;
}
+ bool did_start_fail() noexcept
+ {
+ return start_failed;
+ }
+
+ bool was_start_skipped() noexcept
+ {
+ return start_skipped;
+ }
+
// Add a listener. A listener must only be added once. May throw std::bad_alloc.
void add_listener(service_listener * listener)
{