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.

Possible Duplicate:
redirect output of a running program to /dev/null

Is it possible to change stdout after starting something as a background application in the command line?

Say I run test.py:

import time

while True:
    print "Hello"
    time.sleep(1)

and then do:

$ python test.py &

Can I redirect the output to /dev/null somehow?

Relates to: redirect output of a running program to /dev/null

With an answer on this site: redirect output of a running program to /dev/null by Mike Perdide

It's also a direct duplicate of a StackOverflow question: Redirect STDERR / STDOUT of a process AFTER it's been started, using command line?

share|improve this question
    
See the answer for this related question. –  phunehehe Mar 23 '11 at 1:33
add comment

marked as duplicate by Michael Mrozek Mar 23 '11 at 4:10

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

up vote 1 down vote accepted

Not unless you taught the program to do so somehow (say, on receipt of a particular signal such as SIGUSR1 it reopens sys.stdout and sys.stderr on /dev/null). Otherwise, once it's been started you have very little control over it.

share|improve this answer
add comment

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