Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I have a python app in a remote server that i need to debug, when I run the app locally it prints some debug information (including python tracebacks) that i need to monitor.

Im trying to redirect all the output of the program to a file so I can monitor the remote output using tail -F, here I found the following command to redirect the outputs:

ssh root@myserver 'nohup python /root/python/ &>> /var/log/myapp.log &'

This gets me almost exactly what i want, loggin information and python tracebacks, but i do not get any of the information displayed using print from python, which i need.

so I also tried this command:

ssh root@myserver 'nohup python /root/python/ 2>&1 >> /var/log/myapp.log &'

this logs the output of the program from print and also the logging information, but all the tracebacks are sent to my local terminal where i excecuted the the script and my script gets stuck waiting for any exception to happen in the remote program.

Is there a way I can capture all the information produced by the app without stopping my script?

Thanks in advance for any suggestion.

share|improve this question
up vote 1 down vote accepted

You almost had it... However, all three pipes need to be re-directed to background a process via ssh. Std In, Std Out, Std Err. Thus:

nohup /root/python/ &>/var/log/ </dev/null &

note: &> is the equivalent of redirecting std out and std error at the same time. In other words, it is the shortened version of ' >> /var/log/myapp.log 2>&1'

share|improve this answer


$ ssh  -t root@ "tail -f /var/log/messages" | tee -a mss.txt
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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