I started a long running background-process (dd
with /dev/urandom
) in my ssh console. Later I had to disconnect. When I logged in, again (this time directly, without ssh), the process still seemed to to run.
I am not sure what happened - I did not use disown
. When I logged in later, the process was not listed in top
at first, but after a while it reclaimed a high CPU percentage, as I expected. So I assume dd
is still running.
Now, I'd like to see the progress. I use kill -USR1 <pid>
but nothing is printed. Is there any way to get the output again?
Redirecting all outputs (stdout, stdin, stderr) can disassociate a child process with the parent.
You can try attaching to the process with gdb, type 'c' for continue, and watch that console while you hup it from another.
gdb /bin/dd pid
Thanks to kmarsh's answer and this threads I was able to redirect my lost output (stderr) to a file:
After running
kill -USR1 2616
I can cat my new file:i'm afraid not. but next time - use screen. google for tutorials or start here.
You might be able to see the output by looking in
/proc/(pid of your dd/fd/1
or/proc/(pid)/fd/2
. Cat that, then hit it with a USR1 and see if you get anything.