redirecting python -m CGIHTTPserver 8080 to /dev/null

99 Views Asked by At

The standard > /dev/null and >> /dev/null don't work when a computer sends a GET to the task. eg: pi@raspberrypi:~/server $ python -m CGIHTTPServer 8080 &

results in

192.168.0.109 - - [26/Sep/2016 23:14:48] "GET /cgi-bin/DS1822remote.py HTTP/1.1" 200 -

As I've put the python app into the background with the '&' I'd like to also see the GET requests vanish.

How do I do this or is it even possible?

1

There are 1 best solutions below

2
On BEST ANSWER

You need to redirect stderr, not stdout; best to redirect both with:

 python -m CGIHTTPServer 8080 > /dev/null 2>&1 &

If you still want to expose stdout (to see the start-up message, for example), use:

 python -m CGIHTTPServer 8080 2> /dev/null &