mirror of
https://github.com/troglobit/finit.git
synced 2026-10-20 11:19:35 +00:00
initctl: fix restart of run/tasks, stuck in DONE state
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
c85e28b971
commit
3c4eca60b7
3 files changed
+30
-6
No files matched your search
@@ -74,6 +74,23 @@ static int start(svc_t *svc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* NOTE: this does not wait for svc to be stopped first, that is the
|
||||
* responsibility of initctl to do. Otherwise we'd block PID 1,
|
||||
* or introduce some nasty race conditions.
|
||||
*/
|
||||
static int restart(svc_t *svc)
|
||||
{
|
||||
if (!svc)
|
||||
return 1;
|
||||
|
||||
svc_mark_dirty(svc);
|
||||
svc_start(svc);
|
||||
service_step(svc);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int reload(svc_t *svc)
|
||||
{
|
||||
if (!svc)
|
||||
@@ -88,9 +105,10 @@ static int reload(svc_t *svc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int do_start (char *buf, size_t len) { return call(start, buf, len); }
|
||||
static int do_stop (char *buf, size_t len) { return call(stop, buf, len); }
|
||||
static int do_reload(char *buf, size_t len) { return call(reload, buf, len); }
|
||||
static int do_stop (char *buf, size_t len) { return call(stop, buf, len); }
|
||||
static int do_start (char *buf, size_t len) { return call(start, buf, len); }
|
||||
static int do_restart(char *buf, size_t len) { return call(restart, buf, len); }
|
||||
static int do_reload (char *buf, size_t len) { return call(reload, buf, len); }
|
||||
|
||||
static char query_buf[368];
|
||||
static int missing(char *job, char *id)
|
||||
@@ -327,6 +345,12 @@ static void api_cb(uev_t *w, void *arg, int events)
|
||||
result = do_start(rq.data, sizeof(rq.data));
|
||||
break;
|
||||
|
||||
case INIT_CMD_RESTART_SVC:
|
||||
_d("restart %s", rq.data);
|
||||
strterm(rq.data, sizeof(rq.data));
|
||||
result = do_restart(rq.data, sizeof(rq.data));
|
||||
break;
|
||||
|
||||
case INIT_CMD_STOP_SVC:
|
||||
_d("stop %s", rq.data);
|
||||
strterm(rq.data, sizeof(rq.data));
|
||||
|
||||
Reference in new issue
Block a user