Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a setup with several directories where I can chroot and start the same daemon from. I'd like to be able to tell from which of my multiple directories I started the daemon.

I'd like to find it out by using commands only from outside the chrooted environment, and without having to stop the daemon.

Clarification: When I say "the same daemon" what I mean is that the contents of those directories is identical, the only difference is their path in the host environment.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

Would accessing /proc/<pidnumberofyourdaemon>/ help you? There entries such as cmdline, exe and fdinfo/* should give you a hint. Or, just use lsof :)

share|improve this answer
    
/proc/<pid>/cwd is a symbolic link to the working directory of the process, /proc/<pid>/cwd is a symbolic link to the corresponding binary, both from the host environment's perspective. Also, lsof +p <pid> shows this path. –  Jacobo de Vera Jun 4 '12 at 13:50
add comment

Your Answer

 
discard

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.