[Bug 236117] /usr/sbin/daemon should support stdin,stdout,stderr redirect to files other than /dev/null

2024-06-15 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236117

Tatsuki Makino  changed:

   What|Removed |Added

 CC||tatsuki_mak...@hotmail.com

--- Comment #3 from Tatsuki Makino  ---
Although it's also weird that I'm still using 12.4-STABLE... :)
I replaced /usr/sbin/daemon with one built using the 10.4-STABLE source code.
This is because the behavior of standard output and standard error output has
changed.

I used to use it as follows, but the current version, which specializes in log
output, changes in content.
daemon -p /tmp/daemon.pid cat /dev/somedevice > /tmp/output.dat

I had to update FreeBSD to 13 or 14, but I looked for a workaround to avoid
using daemon of version 10, and I got the following.
daemon -p /tmp/daemon.pid -m 0 -o /dev/null cat /dev/somedevice >
/tmp/output.dat

Setting -m to 0 is not in usage, but it prevents the two output descriptors of
the child process from switching to the log pipe.
Using the -o or -S options suppresses the output of the log to standard output.

It seems that stdin, stdout, and stderr will now be the same as when daemon is
started.
I finally got to it today :)

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


[Bug 236117] /usr/sbin/daemon should support stdin,stdout,stderr redirect to files other than /dev/null

2023-04-14 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236117

--- Comment #2 from Ihor Antonov  ---
zhou...@laocius.org:

You could send logs to syslog, if that works for you.
Check these daemon options:

--syslog   Send output to syslog 
--output-mask  What to send to syslog/file
   1=stdout, 2=stderr, 3=both


I know this is not ideal. I am thinking about the way to add the feature you
request without breaking the current interface and without making it
inconsistent/incoherent..

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


[Bug 236117] /usr/sbin/daemon should support stdin,stdout,stderr redirect to files other than /dev/null

2023-03-05 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236117

Ihor Antonov  changed:

   What|Removed |Added

 CC||ihor@antonovs.family

--- Comment #1 from Ihor Antonov  ---
I am working on daemon improvements and this feature is planned to be added
once transition to kqueue is finished.

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


[Bug 236117] /usr/sbin/daemon should support stdin,stdout,stderr redirect to files other than /dev/null

2019-03-01 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236117

Mateusz Piotrowski <0...@freebsd.org> changed:

   What|Removed |Added

   Severity|Affects Only Me |Affects Some People
 CC||0...@freebsd.org
   Keywords||feature
 Status|New |Open

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"


[Bug 236117] /usr/sbin/daemon should support stdin,stdout,stderr redirect to files other than /dev/null

2019-02-28 Thread bugzilla-noreply
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=236117

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: b...@freebsd.org
  Reporter: zhou...@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 files
respectively.

There is a `-o` option, 

```
  -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. 

The problem can be easily reproduced by 

```
python3 -c 'import subprocess; subprocess.Popen(["/usr/sbin/service",
"mytestservice", "onerestart"], stderr=subprocess.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 stdin,
stdout, stderr separately.

-- 
You are receiving this mail because:
You are the assignee for the bug.
___
freebsd-bugs@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/freebsd-bugs
To unsubscribe, send any mail to "freebsd-bugs-unsubscr...@freebsd.org"