I have several Linux (Ubuntu 10.04) processes running on my computer. If I start one of them, I can see the verbose of it on my terminal. I have an other process that start a dozen of those processes so that they run in background. However, I would like to watch the output of one of these processes to see if the output is still ok and there are no error message. I know I could send everything into a log message, however, this would just use too much disk space. So, is there a way to “catch” the output of a running process in Linux using it’s process Id?
Use redirection like
yourprogram arg1 arg2 > yourprog.out
or probably even (to redirect both stderr & stdout and run in the background)
yourprogram arg1 arg2 > yourprog.out 2>&1 &
In a different terminal, do
tail -f yourprog.out
-f option, the
tail command will notice when the file is growing and will display its newest lines
But I can’t see portable way to redirect after. Maybe
cron might help you. Or opening the
BTW, I am surprised you don’t have enough temporary disk space for your output…
And I do like running
M-x shell under emacs, and running my programm there.
Answered By – Basile Starynkevitch