mirror of
https://github.com/troglobit/finit.git
synced 2026-11-14 19:03:16 +00:00
pidfile: Run the reconf-callback again until no application are in flux
If a service depend on the service last in the list the application will be kept in flux state forever. Signed-off-by: Mattias Walström <mattias.walstrom@westermo.se>
This commit is contained in:
1 parent
f95cd38ddb
commit
816aa9a17c
1 file changed
+18
-5
+18
-5
@@ -30,6 +30,7 @@
|
|||||||
#include "../cond.h"
|
#include "../cond.h"
|
||||||
#include "../helpers.h"
|
#include "../helpers.h"
|
||||||
#include "../plugin.h"
|
#include "../plugin.h"
|
||||||
|
#include "../service.h"
|
||||||
|
|
||||||
struct context {
|
struct context {
|
||||||
int fd;
|
int fd;
|
||||||
@@ -88,16 +89,28 @@ static void pidfile_callback(void *UNUSED(arg), int fd, int UNUSED(events))
|
|||||||
static void pidfile_reconf(void *_null)
|
static void pidfile_reconf(void *_null)
|
||||||
{
|
{
|
||||||
static char name[MAX_ARG_LEN];
|
static char name[MAX_ARG_LEN];
|
||||||
|
|
||||||
svc_t *svc;
|
svc_t *svc;
|
||||||
(void)(_null);
|
(void)(_null);
|
||||||
|
int restart = 0;
|
||||||
|
|
||||||
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
|
do {
|
||||||
if (svc->state == SVC_RUNNING_STATE && !svc_is_changed(svc) && !svc_is_starting(svc)) {
|
restart = 0;
|
||||||
|
|
||||||
|
for (svc = svc_iterator(1); svc; svc = svc_iterator(0)) {
|
||||||
snprintf(name, MAX_ARG_LEN, "svc%s", svc->cmd);
|
snprintf(name, MAX_ARG_LEN, "svc%s", svc->cmd);
|
||||||
cond_set_path(cond_path(name), COND_ON);
|
if (svc->state == SVC_RUNNING_STATE &&
|
||||||
|
!svc_is_changed(svc) &&
|
||||||
|
!svc_is_starting(svc) &&
|
||||||
|
cond_get(name) != COND_ON) {
|
||||||
|
cond_set_path(cond_path(name), COND_ON);
|
||||||
|
restart = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
if (restart)
|
||||||
|
service_step_all(SVC_TYPE_SERVICE | SVC_TYPE_INETD);
|
||||||
|
|
||||||
|
} while (restart);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pidfile_init(void *arg)
|
static void pidfile_init(void *arg)
|
||||||
|
|||||||
Reference in new issue
Block a user