Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

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.