runs-on-console : specifies that this service uses the console; its input
and output should be directed to the console. A service running
on the console prevents other services from running on the
- console (they will queue for the console). For scripted services
- "runs-on-console" applies only during execution of the start
- script.
+ console (they will queue for the console).
The "interrupt" key (normally control-C) will be active for
- process / scripted services that run on the console. This is
- useful to allow filesystem checks to be interrupted/skipped.
+ process / scripted services that run on the console. Handling
+ of an interrupt is determined by the service process, but
+ typically will cause it to terminate.
+
+ starts-on-console : specifies that this service uses the console during
+ service startup. This is implied by runs-on-console, but can
+ be specified separately for services that need the console
+ while they start but not afterwards.
+
+ This setting is not applicable to regular "process" services,
+ but can be used for "scripted" and "bgprocess" services. It
+ allows for interrupting startup via the "interrupt" key
+ (normally control-C). This is useful to allow filesystem checks
+ to be interrupted/skipped.
starts-rwfs : this service mounts the root filesystem read/write (or at
least mounts the normal writable filesystems for the system).
type = scripted
command = /sbin/fsck -A -R -C -a
restart = false
-options = runs-on-console
+options = starts-on-console
depends-on = early-filesystems
depends-on = udevd
type = scripted
command = /etc/dinit.d/rootfscheck.sh start
restart = false
-options = runs-on-console pass-cs-fd
+options = starts-on-console pass-cs-fd
depends-on = early-filesystems
depends-on = udevd
}
else if (option_txt == "runs-on-console") {
onstart_flags.runs_on_console = true;
+ // A service that runs on the console necessarily starts on console:
+ onstart_flags.starts_on_console = true;
+ }
+ else if (option_txt == "starts-on-console") {
+ onstart_flags.starts_on_console = true;
}
else if (option_txt == "pass-cs-fd") {
onstart_flags.pass_cs_fd = true;
// is due to an unexpected process termination.
void ServiceRecord::stopped() noexcept
{
- if (service_type != ServiceType::SCRIPTED && service_type != ServiceType::BGPROCESS
- && onstart_flags.runs_on_console) {
+ if (onstart_flags.runs_on_console) {
tcsetpgrp(0, getpgrp());
discard_console_log_buffer();
releaseConsole();
void ServiceRecord::allDepsStarted(bool has_console) noexcept
{
- if (onstart_flags.runs_on_console && ! has_console) {
+ if (onstart_flags.starts_on_console && ! has_console) {
waiting_for_deps = true;
queueForConsole();
return;
void ServiceRecord::started() noexcept
{
- if (onstart_flags.runs_on_console && (service_type == ServiceType::SCRIPTED || service_type == ServiceType::BGPROCESS)) {
+ if (onstart_flags.starts_on_console && ! onstart_flags.runs_on_console) {
tcsetpgrp(0, getpgrp());
releaseConsole();
}
void ServiceRecord::failed_to_start(bool depfailed) noexcept
{
- if (!depfailed && onstart_flags.runs_on_console) {
+ if (!depfailed && onstart_flags.starts_on_console) {
tcsetpgrp(0, getpgrp());
releaseConsole();
}
// Not actually "onstart" commands:
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
OnstartFlags() noexcept : rw_ready(false), log_ready(false),
- no_sigterm(false), runs_on_console(false), pass_cs_fd(false)
+ no_sigterm(false), runs_on_console(false), starts_on_console(false), pass_cs_fd(false)
{
}
};