Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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: 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

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.

See the answer for this related question. – phunehehe Mar 23 '11 at 1:33
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

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