Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 01 Mar 2019 01:06:59 +0000
From:      bugzilla-noreply@freebsd.org
To:        bugs@FreeBSD.org
Subject:   [Bug 236117] /usr/sbin/daemon should support stdin,stdout,stderr redirect to files other than /dev/null
Message-ID:  <bug-236117-227@https.bugs.freebsd.org/bugzilla/>

next in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236117

            Bug ID: 236117
           Summary: /usr/sbin/daemon should support stdin,stdout,stderr
                    redirect to files other than /dev/null
           Product: Base System
           Version: 11.2-STABLE
          Hardware: Any
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: bin
          Assignee: bugs@FreeBSD.org
          Reporter: zhoutao@laocius.org

The daemon command has an option `-f`, which, according to the man page,
redirects stding,stdout,stderr to /dev/null.

This is fine. But if I cannot redirect stdin, stdout, stderr to different f=
iles
respectively.

There is a `-o` option,=20

```
  -o output_file
             Append output from the daemonized process to output_file.  If =
the
             file does not exist, it is created with permissions 0600.
```

The problem I am having now is that daemon command was used in some freebsd
rc.d scripts without the `-f` option. When I try to restart those services
through python subprocess.Popen, it would hang indefinitely.=20

The problem can be easily reproduced by=20

```
python3 -c 'import subprocess; subprocess.Popen(["/usr/sbin/service",
"mytestservice", "onerestart"], stderr=3Dsubprocess.PIPE).communicate()'
```

I can add the `-f` option to fix the problem, but `-f` will override the `-=
o`
option, and I end up with no log at all.


I think it would be nice if the daemon command can support redirecting stdi=
n,
stdout, stderr separately.

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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-236117-227>