mirror of
https://github.com/troglobit/finit.git
synced 2026-10-16 10:39:35 +00:00
initctl: new command 'reload NAME:ID' and new semantics for restart
This patch corrects a logical glitch, or design flaw, in initctl. The 'restart FOO' command did not stop+start FOO only send SIGHUP (provided FOO supports SIGHUP). Hence, a new command 'reload FOO' is introduced, which does exactly that, and 'restart FOO' now stops and restarts FOO. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
a56220f158
commit
90f7ff1c23
3 files changed
+40
-11
No files matched your search
@@ -74,7 +74,7 @@ static int start(svc_t *svc)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int restart(svc_t *svc)
|
||||
static int reload(svc_t *svc)
|
||||
{
|
||||
if (!svc)
|
||||
return 1;
|
||||
@@ -88,9 +88,9 @@ static int restart(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_restart(char *buf, size_t len) { return call(restart, buf, len); }
|
||||
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 char query_buf[368];
|
||||
static int missing(char *job, char *id)
|
||||
@@ -333,10 +333,10 @@ static void api_cb(uev_t *w, void *arg, int events)
|
||||
result = do_stop(rq.data, sizeof(rq.data));
|
||||
break;
|
||||
|
||||
case INIT_CMD_RESTART_SVC:
|
||||
_d("restart %s", rq.data);
|
||||
case INIT_CMD_RELOAD_SVC:
|
||||
_d("reload %s", rq.data);
|
||||
strterm(rq.data, sizeof(rq.data));
|
||||
result = do_restart(rq.data, sizeof(rq.data));
|
||||
result = do_reload(rq.data, sizeof(rq.data));
|
||||
break;
|
||||
|
||||
case INIT_CMD_GET_RUNLEVEL:
|
||||
|
||||
Reference in new issue
Block a user