2

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

Kit Sunde
  • 4,504
  • 10
  • 31
  • 34

1 Answers1

1

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.

geekosaur
  • 32,047