sh stdout/stderr redirection problem

Polytropon freebsd at
Sat Aug 16 14:54:51 UTC 2014

On Sat, 16 Aug 2014 16:23:53 +0200, Peter Ulrich Kruppa wrote:
> Hi,
> I have got a python3.4 script which I can start from an rc.d script as a
> daemon this way:
>   daemon -p /var/run/ /path/to/python3.4 /path/to/
> /path/to/python3.4 /path/to/ produces interesting messages on
> stdout and stderr, so I would like to collect them in /var/log/my.log .
> I have tried all kinds of combinations of >>'s and 2>&1's but either I
> catch daemon's output which is nothing or the script won't start anymore.
> Any ideas? - Thanks for your help


	# ( daemon -p /var/run/ /path/to/python3.4 /path/to/ ) > /tmp/myscript.log 2>&1

You can use ( ... ) to "summarize" subshell outputs, but in
your case using _script_ is probably the easiest method. It
will capture all output written to the terminal (stdout and
stderr). See "man script" for details.

Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...

More information about the freebsd-questions mailing list