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:
Robert Andersson committed 2018-10-22 12:51:58 +02:00
1 parent 12d14aae84
commit 053304012f
3 files changed
+7

No files matched your search

+1
View File
@@ -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
+5
View File
@@ -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"))
+1
View File
@@ -119,6 +119,7 @@ typedef struct svc {
struct { struct {
char enabled; char enabled;
char null; char null;
char console;
char file[64]; char file[64];
char prio[20]; char prio[20];
char ident[20]; char ident[20];