mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
Add option to log service/task output to the console
Example:
service log:console [2] /usr/sbin/udhcpd -f -- DHCP Server
Signed-off-by: Robert Andersson <robert.m.andersson@se.atlascopco.com>
This commit is contained in:
1 parent
12d14aae84
commit
053304012f
3 files changed
+7
No files matched your search
@@ -350,6 +350,7 @@ syslog using the native `logit` tool. The full syntax is:
|
|||||||
|
|
||||||
log:/path/to/file
|
log:/path/to/file
|
||||||
log:prio:facility.level,tag:ident
|
log:prio:facility.level,tag:ident
|
||||||
|
log:console
|
||||||
log:null
|
log:null
|
||||||
log
|
log
|
||||||
|
|
||||||
|
|||||||
@@ -243,6 +243,9 @@ static int service_start(svc_t *svc)
|
|||||||
redirect_null();
|
redirect_null();
|
||||||
goto logit_done;
|
goto logit_done;
|
||||||
}
|
}
|
||||||
|
if (svc->log.console) {
|
||||||
|
goto logit_done;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Open PTY to connect to logger. A pty isn't buffered
|
* Open PTY to connect to logger. A pty isn't buffered
|
||||||
@@ -558,6 +561,8 @@ static void parse_log(svc_t *svc, char *arg)
|
|||||||
svc->log.enabled = 1;
|
svc->log.enabled = 1;
|
||||||
else if (!strcmp(tok, "null") || !strcmp(tok, "/dev/null"))
|
else if (!strcmp(tok, "null") || !strcmp(tok, "/dev/null"))
|
||||||
svc->log.null = 1;
|
svc->log.null = 1;
|
||||||
|
else if (!strcmp(tok, "console") || !strcmp(tok, "/dev/console"))
|
||||||
|
svc->log.console = 1;
|
||||||
else if (tok[0] == '/')
|
else if (tok[0] == '/')
|
||||||
strlcpy(svc->log.file, tok, sizeof(svc->log.file));
|
strlcpy(svc->log.file, tok, sizeof(svc->log.file));
|
||||||
else if (!strcmp(tok, "priority") || !strcmp(tok, "prio"))
|
else if (!strcmp(tok, "priority") || !strcmp(tok, "prio"))
|
||||||
|
|||||||
Reference in new issue
Block a user