Results 1 to 5 of 5

Thread: PID running directory

  1. #1
    Member alifazman's Avatar
    Join Date
    Sep 2010
    Location
    Malaysia
    Posts
    39

    Default PID running directory

    Hi All.

    How do I check the working directory for example PID :1234. Is it any way to detect in through ssh command /cPanel

    Thanks ya!!

  2. #2
    cPanel Staff cPanelJared's Avatar
    Join Date
    Feb 2010
    Location
    Houston, TX
    Posts
    1,461
    cPanel/WHM Access Level

    Root Administrator

    Default Re: PID running directory

    You can get information about a PID, including its current working directory, by looking in the corresponding subdirectory in /proc. Each running PID has its own directory in /proc. Simply use the ls command to view the contents of /proc/$PID (where $PID is replaced with an actual valid PID).
    For hands-on assistance, please reference our new support information page: Where should I go for support?
    cPResources: Support Options - Submit a ticket here - Additional Support Options - Forums Search - Mailing Lists(Alt) - Documentation - Find cPanel hosting


    -- Jared Ryan, Technical Analyst, cPanel Technical Support

  3. #3
    cPanel Partner NOC cPanel Partner NOC Badge
    Join Date
    Jun 2004
    Posts
    313
    cPanel/WHM Access Level

    DataCenter Provider

    Default Re: PID running directory

    Similarly and perhaps a bit more readable, you can get the cwd of a process using it's PID through lsof. It also will provide information about currently open (or listening) connections, sockets, and open files.

    Code:
    lsof -p <pid>
    NDCHost (ProVPS): Xen VPS / Dedicated / Co-Location
    Contact us for your cPanel Licensing needs! We price match, provide better support, and take care of our customers!

  4. #4
    cPanel Staff cPanelJeff's Avatar
    Join Date
    Sep 2010
    Posts
    144

    Default Re: PID running directory

    Yet another way is via the "readlink" command:

    # readlink /proc/`pgrep cpsrvd`/cwd
    /usr/local/cpanel/base
    cPResources:

    -- cPJeff - Jeff P., Technical Analyst, cPanel Technical Support - Need to submit a ticket? (click here) - Need to check on an existing ticket? (click here)

  5. #5
    Member alifazman's Avatar
    Join Date
    Sep 2010
    Location
    Malaysia
    Posts
    39

    Default Re: PID running directory

    Hello all,

    Thanks for all those information. It helps me

    Happy new year to all ;D

Similar Threads

  1. Mailman PID
    By tictic in forum New User Questions
    Replies: 4
    Last Post: 11-26-2009, 02:23 AM
  2. Error running cpbackup: ls: reading directory .: Input/output error
    By BianchiDude in forum cPanel & WHM Discussions
    Replies: 1
    Last Post: 03-11-2008, 01:58 AM
  3. Kill PID
    By cmwh in forum cPanel & WHM Discussions
    Replies: 4
    Last Post: 04-12-2006, 05:27 AM
  4. Replies: 2
    Last Post: 12-11-2005, 09:45 PM
  5. Running CGI's in the same directory as CPanel themes???
    By nitromax in forum cPanel & WHM Discussions
    Replies: 10
    Last Post: 01-14-2004, 10:54 PM