sh stdout/stderr redirection problem
Peter Ulrich Kruppa
ulrich at pukruppa.de
Sun Aug 17 07:53:39 UTC 2014
On 16.08.2014 19:16, Michael Ross wrote:
> On Sat, 16 Aug 2014 16:23:53 +0200, Peter Ulrich Kruppa
> <ulrich at pukruppa.de> wrote:
>> 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/my.pid /path/to/python3.4 /path/to/myscript.py
>> /path/to/python3.4 /path/to/myscript.py 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
> You could do the redirection in your python script:
> import sys
> def redirect(msg):
Thanks for your idea - using python's redirection should be the "nice"
way to solve my problem, but I have to admit I couldn't get that
working, yet - I end up with an empty logfile.
For now I am happy with Polytropon's script solution, but I will put
your approach on my ToDo list.
>> freebsd-questions at freebsd.org mailing list
>> To unsubscribe, send any mail to
>> "freebsd-questions-unsubscribe at freebsd.org"
> freebsd-questions at freebsd.org mailing list
> To unsubscribe, send any mail to
> "freebsd-questions-unsubscribe at freebsd.org"
More information about the freebsd-questions