mirror of
https://github.com/troglobit/finit.git
synced 2026-10-15 10:29:35 +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
+9
-2
No files matched your search
@@ -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
|
||||
|
||||
|
||||
+7
-2
@@ -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"))
|
||||
|
||||
Reference in new issue
Block a user