Actually I need to know the running processes on remote server.
I must clear one thing that we don't have any access right problems for that server. We can access that server from my local machine.
Now what I want to do is designing of a graphical application in which User can have view to all processes running on that server machine, and according to the user right he/she can cancel/kill the process.
I have done some work besides of Swing designing for getting the list of processes of Local Machines. Here it is as follows.
Now could anyone let me know, How to get the remote running(live) processes if we know the IP of that machine.
For this we can let suppose the IP of machine is XYZ.ABC.DEF.RDE.
Thanks in advance for replies.
[ March 14, 2007: Message edited by: Ankur Sharma ] [ March 14, 2007: Message edited by: Ankur Sharma ]
The Best way to predict your future is to create it - Every great individual common man
That would be fine, yes. A servlet could use Runtime.exec("tasklist") to get the list of processes and then display them in a form that let the user select processes to kill. When the form was submitted, the servlet (or another one, of course) receiving the form could then use Runtime.exec() to execute whatever Windows program you can run to kill a process (I'm assuming there is one.)
This is actually *two* commands. The "ps" command is providing the list of tasks. The output of that command is piped to the "grep" command which is getting rid of every line that doesn't have "java" in it.
If you want to get this to work, you may have to run a "sh" command, passing these two commands as parameters, as you need a shell to setup the pipes.
IMHO, I would recommend just using the "ps -ef" command. Once you get the output stream of the command, you can filter to what you need with Java. No need for another "sh", or the "grep" command.
This is simple on linux. You just ssh into the remote machine, and execute your command there as if you are local. My Mandriva Linux and I assume every other Linux out there already does this. I can display, memory, file usage, cpu usage, network usage, all that good stuff for the local machine. To display it for a remote machine I first connect to it through ssh.
Perhaps you can do that. Its more secure and should abstract you from much of your code to have to know the data is coming remotely. and for the local machine you can 'ssh localhost' for consistency.
as Henry said "ps -ef|grep java" is two commands. Seperated by a 'pipe' which is represented by '|'. The data from ps -ef is piped into 'grep java'. This is the same technique that you would use to pipe your command through the ssh tunnel so it is executed remotely.
I dont know right off hand how to do it, and my computer here termprarily does not have ssh so I cant check it. [ March 14, 2007: Message edited by: Mr. C Lamont Gilbert ]
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
subject: How to Get processes list from Remote Machine