mirror of
https://github.com/troglobit/finit.git
synced 2026-10-28 12:30:44 +00:00
Refactor, set STOPPING state in service_stop()
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
2c904b5b44
commit
fa02b59db5
1 file changed
+4
-5
+4
-5
@@ -429,6 +429,8 @@ static int service_stop(svc_t *svc)
|
|||||||
|
|
||||||
if (do_progress)
|
if (do_progress)
|
||||||
print_result(0);
|
print_result(0);
|
||||||
|
|
||||||
|
svc_set_state(svc, SVC_STOPPING_STATE);
|
||||||
return 0;
|
return 0;
|
||||||
} else
|
} else
|
||||||
#endif
|
#endif
|
||||||
@@ -443,6 +445,8 @@ static int service_stop(svc_t *svc)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
_d("Sending SIGTERM to pid:%d name:%s", svc->pid, pid_get_name(svc->pid, NULL, 0));
|
_d("Sending SIGTERM to pid:%d name:%s", svc->pid, pid_get_name(svc->pid, NULL, 0));
|
||||||
|
svc_set_state(svc, SVC_STOPPING_STATE);
|
||||||
|
|
||||||
if (runlevel != 1)
|
if (runlevel != 1)
|
||||||
print_desc("Stopping ", svc->desc);
|
print_desc("Stopping ", svc->desc);
|
||||||
|
|
||||||
@@ -1043,7 +1047,6 @@ restart:
|
|||||||
case SVC_RUNNING_STATE:
|
case SVC_RUNNING_STATE:
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
svc_set_state(svc, SVC_STOPPING_STATE);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,7 +1080,6 @@ restart:
|
|||||||
switch (cond) {
|
switch (cond) {
|
||||||
case COND_OFF:
|
case COND_OFF:
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
svc_set_state(svc, SVC_STOPPING_STATE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COND_FLUX:
|
case COND_FLUX:
|
||||||
@@ -1094,7 +1096,6 @@ restart:
|
|||||||
service_restart(svc);
|
service_restart(svc);
|
||||||
} else {
|
} else {
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
svc_set_state(svc, SVC_STOPPING_STATE);
|
|
||||||
}
|
}
|
||||||
svc_mark_clean(svc);
|
svc_mark_clean(svc);
|
||||||
}
|
}
|
||||||
@@ -1106,7 +1107,6 @@ restart:
|
|||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
kill(svc->pid, SIGCONT);
|
kill(svc->pid, SIGCONT);
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
svc_set_state(svc, SVC_STOPPING_STATE);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1126,7 +1126,6 @@ restart:
|
|||||||
case COND_OFF:
|
case COND_OFF:
|
||||||
kill(svc->pid, SIGCONT);
|
kill(svc->pid, SIGCONT);
|
||||||
service_stop(svc);
|
service_stop(svc);
|
||||||
svc_set_state(svc, SVC_STOPPING_STATE);
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case COND_FLUX:
|
case COND_FLUX:
|
||||||
|
|||||||
Reference in new issue
Block a user