0

I want to read all the running process in linux server from my C#.net client ? Can you please show me the way or possibility for achieving this ?

We are in same domain.. I guess no firewall issue and but I cannot write or install anything on server.

(I am trying this to get hold of the process id running on linux box and when that process changes the process id .. i have to run some logic in my client app)

Timwi
  • 65,159
  • 33
  • 165
  • 230
Jon kra
  • 1
  • 1
  • Short of running _ps_ via rsh or ssh from a client program, I'm not sure there's going to be a better or possible way to do this. Curious to see if there are other options. – Joe Sep 13 '10 at 01:57
  • Maybe I'm missing something, but can linux processes actually change their ID? – R. Martinho Fernandes Sep 13 '10 at 01:58
  • @Joe: Why do you assume there needs to be another option? Calling `ps` through ssh is definitely going to be the most portable. If the right snmp agents are already installed, it might be possible to get a process list as an snmp table, but that won't work on an out-of-the-box install of most distros. – Ben Voigt Sep 13 '10 at 02:51
  • @Ben Voigt: Not assuming, just curious. In this situation that's what I'd do. @Martinho: the same process can't change it's ID, but if the process stops/restarts (either manually or automatically) it's going to have a new PID. – Joe Sep 13 '10 at 12:58

1 Answers1

4

You will need to do this via SSH. For C#, I'd take a look at SharpSSH. Run ps -e | grep and you should be able to parse the ID number quite easily.

As far as I know, process IDs only change when the process is restarted, but I am no authority on the matter.

Alex Hart
  • 1,663
  • 12
  • 15