1
0
mirror of https://github.com/systemd/systemd.git synced 2025-03-21 02:50:18 +03:00

service: never do automatic restarts for user requested stops

This commit is contained in:
Lennart Poettering 2010-04-23 22:55:14 +02:00
parent 6089f4a9a8
commit 3a76266192
2 changed files with 8 additions and 0 deletions

View File

@ -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;
}

View File

@ -110,6 +110,8 @@ struct Service {
bool bus_name_good:1;
bool allow_restart:1;
bool got_socket_fd:1;
bool sysv_has_lsb:1;