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