From: Davin McCall Date: Mon, 2 Oct 2017 19:20:51 +0000 (+0100) Subject: Add "depends-ms" dependency option for milestone dependencies. X-Git-Tag: v0.06~9 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f4644f44f22642ee7bbb3d73c94bd5c4c53f9a0b;p=oweals%2Fdinit.git Add "depends-ms" dependency option for milestone dependencies. --- diff --git a/README b/README index 6c7bd26..665e5a0 100644 --- a/README +++ b/README @@ -142,6 +142,7 @@ command = ... logfile = ... options = ... depends-on = (service name) +depends-ms = (service name) waits-for = (service name) command = (external script or executable, and arguments) @@ -198,6 +199,13 @@ depends-on = (service name) executed until the named service has started. If the named service is stopped then this service will also be stopped. +depends-ms = (service name) + Indicates a "milestone dependency" on the named service. This service + requires the named service to start before it starts itself. Once the + named service has started, it remains active due to the dependency, but if + it stops for any reason then the dependency link is broken until the next + time this service is started. + waits-for = (service name) When this service is started, wait for the named service to finish starting (or to fail starting) before commencing the start procedure diff --git a/doc/manpages/dinit.8 b/doc/manpages/dinit.8 index e54a46a..21349a5 100644 --- a/doc/manpages/dinit.8 +++ b/doc/manpages/dinit.8 @@ -168,6 +168,12 @@ the named service; the command to start this service will not be executed until the named service has started. If the named service is stopped then this service will also be stopped. .TP +\fBdepends-ms\fR = \fIservice-name\fR +This service has a "milestone" dependcy on the named service. Starting this +service will start the named service; the command to start this service will +not be executed until the named service has started. If the named service is +stopped then the dependency is dropped until this service is next started. +.TP \fBwaits-for\fR = \fIservice-name\fR When this service is started, wait for the named service to finish starting (or to fail starting) before commencing the start procedure for this service. diff --git a/src/load_service.cc b/src/load_service.cc index 45c6c18..4937dee 100644 --- a/src/load_service.cc +++ b/src/load_service.cc @@ -476,6 +476,10 @@ service_record * dirload_service_set::load_service(const char * name) string dependency_name = read_setting_value(i, end); depends.emplace_back(load_service(dependency_name.c_str()), dependency_type::REGULAR); } + else if (setting == "depends-ms") { + string dependency_name = read_setting_value(i, end); + depends.emplace_back(load_service(dependency_name.c_str()), dependency_type::MILESTONE); + } else if (setting == "waits-for") { string dependency_name = read_setting_value(i, end); depends.emplace_back(load_service(dependency_name.c_str()), dependency_type::WAITS_FOR);