cancel
Showing results for 
Search instead for 
Did you mean: 

daemon process

 
Highlighted
Occasional Contributor

daemon process

Hello All,
I have a daemon process, which is aborting. It does not create core file. This process is not loggin much of the log process.
I want to debugg with out modifying source code.
Is there any way I can get the error message this daemon process thowing on STDERR.
I tried playing around with file descriptor but it did not work.
I redirect 1>& and 2>& and then start the process but nothing is logged into file.
I tried something like
3<>File # open a file with FD 3
3<&2 # assign STDERR to 3
3<&1 # assign STDIN to 3
but nothing is working out

Can somebody advise if it is possible to get error message from a daemon process.

Thanks,
Vineet.
3 REPLIES 3
Highlighted
Honored Contributor

Re: daemon process

You should be doing the redirect on the command line that starts the process.

Something like:

# startprocess > /var/tmp/errorfile 2>&1

Highlighted
Acclaimed Contributor

Re: daemon process

Some demons go out of their way to close stdout and stderr and reopen /dev/null. Do you do that?

You might be able to do:
startprocess 3> /var/tmp/errorfile

Then attach with gdb before the error and:
p close(2)
p dup(3)
Highlighted
Occasional Contributor

Re: daemon process

Thank you,
Vineet.