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"

and then do:

$ python test.py &

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

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

With an answer on this site: How to 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?

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.


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.

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