systemctl: consider service running only when it is in active or reloading state

Patch cherry-picked from upstream master.

Gbp-Dch: Short
This commit is contained in:
Martin Pitt 2016-09-11 09:09:31 +02:00
parent 4d0a5249de
commit f3c4eafa52
3 changed files with 28 additions and 1 deletions

View File

@ -11,7 +11,7 @@ as PID 1.
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 6a0ed79..89e54f7 100644
index db64840..f058a72 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -7659,17 +7659,22 @@ static int talk_initctl(void) {

View File

@ -12,6 +12,7 @@ seccomp-also-detect-if-seccomp-filtering-is-enabled.patch
nspawn-detect-SECCOMP-availability-skip-audit-filter-if-u.patch
shared-recognize-DNS-names-with-more-than-one-trailing-do.patch
networkd-limit-the-number-of-routes-to-the-kernel-limit-4.patch
systemctl-consider-service-running-only-when-it-is-in-act.patch
debian/Use-Debian-specific-config-files.patch
debian/don-t-try-to-start-autovt-units-when-not-running-wit.patch
debian/Make-logind-hostnamed-localed-timedated-D-Bus-activa.patch

View File

@ -0,0 +1,26 @@
From: =?utf-8?q?Luk=C3=A1=C5=A1_Nykr=C3=BDn?= <lnykryn@redhat.com>
Date: Wed, 3 Aug 2016 17:08:37 +0200
Subject: systemctl: consider service running only when it is in active or
reloading state (#3874)
Otherwise for example services that are failing on start and have Restart=on-failure
and bigger RestartSec systemctl status will return 0.
Fixes: #3864
---
src/systemctl/systemctl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 6a0ed79..db64840 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -4767,7 +4767,7 @@ static int show_one(
else if (streq(verb, "status")) {
print_status_info(bus, &info, ellipsized);
- if (info.active_state && STR_IN_SET(info.active_state, "inactive", "failed"))
+ if (info.active_state && !STR_IN_SET(info.active_state, "active", "reloading"))
r = EXIT_PROGRAM_NOT_RUNNING;
else
r = EXIT_PROGRAM_RUNNING_OR_SERVICE_OK;