summaryrefslogtreecommitdiff
path: root/service.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-23 22:55:14 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-23 22:55:14 +0200
commit3a76266192da84f6f7b84725e7647c82f8407278 (patch)
tree753014b24d617fbfcf2ac5c55c64688b92e77f80 /service.c
parent6089f4a9a85111ac7056834ba951aed599ab3c2b (diff)
service: never do automatic restarts for user requested stops
Diffstat (limited to 'service.c')
-rw-r--r--service.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/service.c b/service.c
index eb8688671b..84077a19f1 100644
--- a/service.c
+++ b/service.c
@@ -1318,6 +1318,7 @@ static void service_enter_dead(Service *s, bool success, bool allow_restart) {
s->failure = true;
if (allow_restart &&
+ s->allow_restart &&
(s->restart == SERVICE_RESTART_ALWAYS ||
(s->restart == SERVICE_RESTART_ON_SUCCESS && !s->failure))) {
@@ -1721,6 +1722,7 @@ static int service_start(Unit *u) {
s->failure = false;
s->main_pid_known = false;
+ s->allow_restart = true;
service_enter_start_pre(s);
return 0;
@@ -1754,6 +1756,10 @@ static int service_stop(Unit *u) {
assert(s->state == SERVICE_RUNNING || s->state == SERVICE_EXITED);
+ /* This is a user request, so don't do restarts on this
+ * shutdown. */
+ s->allow_restart = false;
+
service_enter_stop(s, true);
return 0;
}