Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I would like to save the standard output of the program motion in a text file. If I don't use motion in daemon-mode I would simply do it by:

motion > log.txt

But what is the equivalent when I run it in daemon-mode? I cannot specify implicit logging at least according to motion's man page.

share|improve this question
    
@jordanm What you say is not true. Programs of various sorts can close the stdout or stderr but there is absolutely no necessity for the daemon to do so. –  Karlson Aug 30 '12 at 13:46
add comment

1 Answer 1

In this context the word daemon means just, that after forking the parent-process exits. So, if the newly created daemon still logs data on STDOUT respectively STDERR redirection should work as you would expect in the non-daemon case.

If motion closes STDOUT and STDERR after forking you have no chance to log anything (motion have to) since nothing can be written by motion to STDOUT or STDERR anylonger.

If the execution of motion and motion -magicdaemonswitch only differs in the way that with -magicdaemonswitch a fork is made. You should be fine to start motion with

motion > log.txt &
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.