From: Davin McCall Date: Tue, 12 Jan 2016 00:58:55 +0000 (+0000) Subject: During shutdown, let process attrition occur naturally, instead of forcing X-Git-Tag: v0.01~33 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=4e335c17e50a6bce4897c602484f7337acc3bd3c;p=oweals%2Fdinit.git During shutdown, let process attrition occur naturally, instead of forcing the services down early. Also, don't restart a service which has desired_state = STARTED if auto-restart is disabled. --- diff --git a/src/service.cc b/src/service.cc index 2be1d21..f810b04 100644 --- a/src/service.cc +++ b/src/service.cc @@ -74,7 +74,7 @@ void ServiceRecord::stopped() noexcept dependency->dependentStopped(); } - if (desired_state == ServiceState::STARTED) { + if (desired_state == ServiceState::STARTED && service_set->get_auto_restart()) { // Desired state is "started". do_start(); } @@ -144,7 +144,8 @@ void ServiceRecord::handle_exit_status() noexcept } if (need_stop) { - if (! do_auto_restart()) desired_state = ServiceState::STOPPED; + // Failed startup: no auto-restart. + desired_state = ServiceState::STOPPED; do_stop(); } diff --git a/src/service.h b/src/service.h index 1817db4..64ae15c 100644 --- a/src/service.h +++ b/src/service.h @@ -545,7 +545,7 @@ class ServiceSet restart_enabled = false; shutdown_type = type; for (std::list::iterator i = records.begin(); i != records.end(); ++i) { - (*i)->stop(); + (*i)->stop(false); (*i)->unpin(); } }