diff --git a/docs/config.md b/docs/config.md index 6be0037a..7a563fa9 100644 --- a/docs/config.md +++ b/docs/config.md @@ -350,6 +350,7 @@ syslog using the native `logit` tool. The full syntax is: log:/path/to/file log:prio:facility.level,tag:ident + log:console log:null log diff --git a/src/service.c b/src/service.c index 290abf0f..0c620255 100644 --- a/src/service.c +++ b/src/service.c @@ -139,7 +139,7 @@ static int is_norespawn(void) * @svc: Service to start * * Returns: - * 0 if the service was successfully started. Non-zero otherwise. + * 0 if the service was successfully started. Non-zero otherwise. */ static int service_start(svc_t *svc) { @@ -243,6 +243,9 @@ static int service_start(svc_t *svc) redirect_null(); goto logit_done; } + if (svc->log.console) { + goto logit_done; + } /* * Open PTY to connect to logger. A pty isn't buffered @@ -466,7 +469,7 @@ static int service_stop(svc_t *svc) * * This function does some basic checks of the runtime state of Finit * and a sanity check of the @svc before sending %SIGHUP. - * + * * Returns: * POSIX OK(0) or non-zero on error. */ @@ -558,6 +561,8 @@ static void parse_log(svc_t *svc, char *arg) svc->log.enabled = 1; else if (!strcmp(tok, "null") || !strcmp(tok, "/dev/null")) svc->log.null = 1; + else if (!strcmp(tok, "console") || !strcmp(tok, "/dev/console")) + svc->log.console = 1; else if (tok[0] == '/') strlcpy(svc->log.file, tok, sizeof(svc->log.file)); else if (!strcmp(tok, "priority") || !strcmp(tok, "prio")) diff --git a/src/svc.h b/src/svc.h index 415ff741..b493e827 100644 --- a/src/svc.h +++ b/src/svc.h @@ -119,6 +119,7 @@ typedef struct svc { struct { char enabled; char null; + char console; char file[64]; char prio[20]; char ident[20];