redirect thread dump to a new file


how can i send kill -3 PID result to a new file. it goes my nohup.file and it is difficult to trace it.

thanks in advance...
Who is Participating?
What OS are you running?
Thread is a separate process (with pid) or just a user-level thread withing the same process?
If thread is within the same process, there is no means to redirect it's output to a separate file, you must rewrite application to do separate output.
If thread is a 'child' with it's own pid, I proposed a solution above for Linux, without rewriting code.
kill -3 PID  > /path-to/myfile 2>&1
ysnky, do you mean your process redirects it's output to nohup.out when you send SIGQUIT to it?
I see no way to redirect output then. Output is already redirected to 'nohup.out' (which is probably done 'nohup' command).

Or you just need to redirect the output of 'kill' command? In this case I agree with yuzh.

Or provide more details of what do you want.
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

ysnkyAuthor Commented:
> Output is already redirected to 'nohup.out' (which is probably done 'nohup' command).

yes my application is started with nohup and my all outputs are sent to nohup.out. i dont would like to change it, i would like that while it is sending out to nohup.out, to send thread dump to another file bacause it sends nohup.out default and it is very difficult to trace it.

is it possbile?

So, your application is mulithreaded or forks childs.
They all write to the same file descriptor (I mean stdout and stderr, that goes to the same nohup.out). And there is no way to split that output unless you rewrite that application.

If you start different applications, you may direct output to different files.

You may get separate output of all children with this command:

strace -ff -o nohup -t -e trace=write -e write=1,2 nohup /path/to/your/program

you will have separate files for each child, like 'nohup.$pid'. The output in 'nohup.out' still remains the same while in 'nohup' and 'nohup.$pid' you will get the output in hexdump and in ascii format.
ysnkyAuthor Commented:
in this case it is inpossible to redirect the thread dump to a new file while because of i started with nohup and i directed all outputs to nohup.out?

ysnkyAuthor Commented:
OS: sun solaris and HP Unix

just a user-level thread withing the same process

thanks guys...
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.