[Bug 207248] [patch] daemon(8): Add option to redirect stdout and stderr to a file

bugzilla-noreply at freebsd.org bugzilla-noreply at freebsd.org
Tue Feb 16 14:22:19 UTC 2016


https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=207248

            Bug ID: 207248
           Summary: [patch] daemon(8): Add option to redirect stdout and
                    stderr to a file
           Product: Base System
           Version: 10.2-RELEASE
          Hardware: Any
                OS: Any
            Status: New
          Keywords: patch
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: freebsd-bugs at FreeBSD.org
          Reporter: me at cschwarz.com
          Keywords: patch

Created attachment 167080
  --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=167080&action=edit
Patch for daemon(8) and its man page enabling IO redirection.

Some applications that are daemonized using daemon(8) do not provide means to
write log files. stdout / stderr is their only way to provide output.

While this behavior is debatable, we already built a tool that deals with
applications that do not daemonize themselves, daemon(8).

Currently, daemon(8) only has a flag `-f` to redirect both stdout and stderr to
/dev/null.
Setting the flag causes the daemon(3) call to be called with daemon(*, 0).

However, daemon(3) does not provide means to specify alternative redirection
destinations.

The patch attached to this bug report adds flags `-e`, `-o` and `-a` to
daemon(8) that can be used instead of `-f` to redirect stderr and stdout to
specified file paths.
`-a` is used to toggle appending instead of overwriting the specified path.

The man page has been updated to reflect the changes made to the source code.

The flags have been chosen semantically and syntactically identical to
`http://software.clapper.org/daemonize/` which is a tool available both in many
Linux distributions and in the ports tree.

However, I would like to see the features implemented in this patch in the base
system. (Naturally, ) I think the code provided by this patch is much more
straight forward and cleaner than the aforementioned third party tool.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the freebsd-bugs mailing list