views:

49

answers:

2

Hello,

I was wondering which libraries or API's would be useful in this. what im aiming for is to be able to type a command into a prompt and then specify which computer(out of all of them that are networked together) to execute that command on. the second part is i want to be able to see that command execute and the result on the computer that was specified.

for example if i enter "firefox www.google.com, desktop2" i want to be able to see the window open on the monitor of that computer. Do you understand what im trying to do? any help is appreciated.

Thanks, Morpheous

+1  A: 

I think I do, but not why. For example, there are existing mechanisms for doing this. If you've got sshd running on each of your "multiple computers" you could simply, from "control", run:

ssh -X user@desktop2 firefox www.google.com

and you'd use remote X to forward firefox back to your local desktop (actually being executed on desktop2). Try man ssh for more information and ask on serverfault if you want to know more.

If you're looking to develop something that achieves this sort of idea, that's a different matter and I'd question if Java is the best way to do it (opinions vary but it's not a "systems language"). Again, existing solutions exist such as the build systems used for projects like Fedora (see Koji).

My advice would be to research a lot of existing code and only if this doesn't solve your problem or if you want a challenge, write something new.

Ninefingers
i realize there are exsisting ways of doing this, but im researching this in particular for a way bigger project, and this is a part of it thanks tho, i will keep ssh in mind when doing this task. :)
Morpheous
A: 

On Windows, PSExec will do that:

The command line is

Usage: psexec [\\computer[,computer2[,...] | @file]
              [-u user [-p psswd]][-n s][-l][-s|-e][-x][-i [session]]
              [-c [-f|-v]][-w directory][-d][-<priority>][-a n,n,... ] 
              cmd [arguments]

For example:

psexec \\computer2 -i firefox.exe www.google.com

Will execute firefox interactively on the remote computer.

See - PSExec, Microsoft PStools

mdma
can psexec be combined into a larger java program? and do you know anything that does the same on linux?
Morpheous
I'd suggest you search elsewhere on Stack Overflow in order to see how to execute a shell command in Java (it's been answered many times). X-forwarding over SSH (i.e. Ninefingers' answer) is how you'd want to do it in Linux (ideally, with certificates instead of passwords).
Catchwa