From: Davin McCall Date: Wed, 22 Jun 2016 08:08:29 +0000 (+0100) Subject: Remove redundant service settings. X-Git-Tag: v0.04~20 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=a5f387b976371a61287bd2b1e8626d025b0ce145;p=oweals%2Fdinit.git Remove redundant service settings. Change "nosigterm" option to "no-sigterm". --- diff --git a/README b/README index f4dbf1a..934cb98 100644 --- a/README +++ b/README @@ -139,7 +139,7 @@ Parameters are: type = process | bgprocess | scripted | internal command = ... logfile = ... -onstart = ... +options = ... depends-on = (service name) waits-for = (service name) @@ -163,9 +163,9 @@ smooth-recovery = yes | true | no | false the service does not reach the stopped state when the process terminates unexpectedly). -onstart = (internal commands) - rw_ready - try again to open any logs, control socket etc that could not - be opened previously due to a read-only filesystem. +pid-file = (path to file) + For "bgprocess" type services only; specifies the path of the file where + daemon will write its process ID before detaching. depends-on = (service name) This service depends on the named service. Starting this service will @@ -208,32 +208,29 @@ termsignal = HUP | INT | QUIT | USR1 | USR2 sent along with the specified signal, unless the 'nosigterm' setting is set true. -nosigterm = yes | true | no | false - If true, the TERM signal will not be sent to the process to kill it. (If - an alternate signal is specified using the "termsignal" setting, that - signal will be sent instead; otherwise, no signal will be sent, and the - process must be killed by external means). - -runs-on-console = yes | no | true | false - If true, the service runs on the console; its input and output are - directed to the console (actually, to the terminal on which Dinit is - running) and Dinit's own output will be suppressed during this time. - Control signals (^C) may be used to control a service running on the - console. - - This is useful to allow a "login" master service to prevent Dinit output - once terminal sessions are spawned, or to make fsck display its progress - on the terminal (and be interruptible). - - Only one service can run on the console at a time (services will queue - in order to gain access to the console). - - For scripted services, only the start command runs on the console. - Process services and internal services take the console for the entire - time that they are active (and cannot release it). - options = ( runs-on-console | nosigterm | starts-rwfs | starts-log ) ... - This is a newer way of specifying some of the above options - (runs-on-console, nosigterm, onstart = rw_ready) and an additional option - for specifying that this service is the system logging service, which - Dinit can log to once the service has started. + Specifies various options for this service: + + no-sigterm : specifies that the TERM signal should not be send to the + process to terminate it. (Another signal can be specified using + the "termsignal" setting; if no other signal is specified, NO + signal will be sent). + + 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. + + 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. + + starts-rwfs : 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. + + starts-log : this service starts the system log daemon. Dinit will begin + logging via the /dev/log socket. diff --git a/TODO b/TODO index dac5ffc..cd0ad0b 100644 --- a/TODO +++ b/TODO @@ -1,9 +1,9 @@ * Complete control socket handling and protocol - support for listing all services and their state * Implement a control utility to start/stop services after dinit has started - - very basic version exists, needs thorough cleanup -* Redundant settings ("onstart" commands etc) should be removed - (see description of "options" setting). + - basic version exists, needs a little more work to support all + start/stop command variants +* Sort out single-user mode startup For version 1.0: ---------------- @@ -12,6 +12,10 @@ For version 1.0: of code where it may be missing - check TODO's in code). * Write wtmp entry on startup (see simpleinit) * Allow running services as a different UID +* Must be able to specify kill timeout (after which kill -9!) +* Must rate-limit restart of services +* "triggered" service type: external process notifies Dinit when the service + has started. For later: * On linux when running with PID != 1, write PID to /proc/sys/kernel/cad_pid so diff --git a/src/load_service.cc b/src/load_service.cc index a4a4f88..d43630a 100644 --- a/src/load_service.cc +++ b/src/load_service.cc @@ -436,23 +436,6 @@ ServiceRecord * ServiceSet::loadServiceRecord(const char * name) " \"process\", \"bgprocess\" or \"internal\""); } } - else if (setting == "onstart") { - // deprecated - std::list> indices; - string onstart_cmds = read_setting_value(i, end, &indices); - for (auto indexpair : indices) { - string onstart_cmd = onstart_cmds.substr(indexpair.first, indexpair.second - indexpair.first); - if (onstart_cmd == "rw_ready") { - onstart_flags.rw_ready = true; - } - else if (onstart_cmd == "log_ready") { - onstart_flags.log_ready = true; - } - else { - throw new ServiceDescriptionExc(name, "Unknown onstart command: " + onstart_cmd); - } - } - } else if (setting == "options") { std::list> indices; string onstart_cmds = read_setting_value(i, end, &indices); @@ -464,7 +447,7 @@ ServiceRecord * ServiceSet::loadServiceRecord(const char * name) else if (option_txt == "starts-log") { onstart_flags.log_ready = true; } - else if (option_txt == "nosigterm") { + else if (option_txt == "no-sigterm") { onstart_flags.no_sigterm = true; } else if (option_txt == "runs-on-console") { @@ -474,7 +457,6 @@ ServiceRecord * ServiceSet::loadServiceRecord(const char * name) throw new ServiceDescriptionExc(name, "Unknown option: " + option_txt); } } - } else if (setting == "termsignal") { string signame = read_setting_value(i, end, nullptr); @@ -486,16 +468,6 @@ ServiceRecord * ServiceSet::loadServiceRecord(const char * name) term_signal = signo; } } - else if (setting == "nosigterm") { - // deprecated - string sigtermsetting = read_setting_value(i, end); - onstart_flags.no_sigterm = (sigtermsetting == "yes" || sigtermsetting == "true"); - } - else if (setting == "runs-on-console") { - // deprecated - string runconsolesetting = read_setting_value(i, end); - onstart_flags.runs_on_console = (runconsolesetting == "yes" || runconsolesetting == "true"); - } else { throw ServiceDescriptionExc(name, "Unknown setting: " + setting); }