From 91af77249454b1e322e4675247e257dfb0441e02 Mon Sep 17 00:00:00 2001 From: Davin McCall Date: Mon, 6 Jun 2016 08:30:38 +0100 Subject: [PATCH] Release on failure to start. (Ensures dependencies will stop if they are not otherwise required). --- src/service.cc | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/service.cc b/src/service.cc index 98de0e5..6900d4e 100644 --- a/src/service.cc +++ b/src/service.cc @@ -122,7 +122,7 @@ bool ServiceRecord::do_auto_restart() noexcept void ServiceRecord::handle_exit_status() noexcept { - if (exit_status != 0 && service_state != ServiceState::STOPPING) { + if (service_type != ServiceType::SCRIPTED && exit_status != 0 && service_state != ServiceState::STOPPING) { log(LogLevel::ERROR, "Service ", service_name, " process terminated with exit code ", exit_status); } @@ -186,7 +186,7 @@ void ServiceRecord::handle_exit_status() noexcept } else { // ??? failed to stop! Let's log it as info: - log(LogLevel::INFO, "service ", service_name, " stop command failed with exit code ", exit_status); + log(LogLevel::INFO, "Service ", service_name, " stop command failed with exit code ", exit_status); // Just assume that we stopped, so that any dependencies // can be stopped: stopped(); @@ -198,7 +198,7 @@ void ServiceRecord::handle_exit_status() noexcept } else { // failed to start - log(LogLevel::ERROR, "service ", service_name, " command failed with exit code ", exit_status); + log(LogLevel::ERROR, "Service ", service_name, " command failed with exit code ", exit_status); failed_to_start(); } } @@ -580,6 +580,7 @@ void ServiceRecord::failed_to_start(bool depfailed) noexcept logServiceFailed(service_name); service_state = ServiceState::STOPPED; + stop(); // release dependencies if appropriate notifyListeners(ServiceEvent::FAILEDSTART); // Cancel start of dependents: -- 2.25.1