0

I have several Nginx installs on my server and now i cannot seem to figure out where the currently running Nginx is running from..

I have the PID which is: 12530

Can i use that to find out where Nginx is running from?

Or is there any other way?

Laine
  • 79
  • 1
  • 8

3 Answers3

0

EDIT: wait, you've got a PID, it's not as difficult as the-below. Just look at the output of:

$ sudo ls -l /proc/12530/exe

If by "where Nginx is running from" you mean "which particular binary", you can use something like the following:

$ sudo lsof | grep nginx | grep txt
nginx  8100  root  txt  REG     202,1   7645520    1931225 /usr/sbin/nginx
...

..which tells me that the version at /usr/sbin/nginx is running.

You might need to apt-get install lsof.

nickgrim
  • 5,387
  • 1
  • 22
  • 28
0

Take a look in /proc/<PID>/. It contains lots of information about the process and is documented in proc(5). The file exe will be a symlink to the executable. I.e:

$ ls -l /proc/11806/exe 
lrwxrwxrwx 1 u u 0 Feb  7 13:15 /proc/11806/exe -> /usr/bin/emacs23-x

PID 11806 is running the emacs23-x executable.

Martin
  • 5,119
  • 3
  • 18
  • 16
0

How bout this?

lsof -p <pid> | grep txt
Satish
  • 16,544
  • 29
  • 93
  • 149