Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

executing program on remote machine

Status
Not open for further replies.

nikitasingh

Programmer
Aug 26, 2007
2
US
Hello,
I have a question related to c on unix.
Say there are two machines system1 and system2.
I have a hello world program which prints hello world.
I want to execute this hello world program on system1 and system2 and see the performance of both the systems.

Does unix provides any function/system call to execute the program on a remote machine ?
something like execute(machine name, name of the program)

Thanks
Nikita.
 
Try RPCs. These are different on different implementations so if your two machines are say SunOS and AIX, you may have platform specific code.
 
If you want to execute it on a single other machine, just do something like:
Code:
$ ssh you@wherever "command arg1 arg2"

If you want to execute it on multiple other machines in parallel, use a utility like shmux. There's a list of similar utilities at the bottom of the shmux page, so take your pick.
 
Thank you guys for your help. But I guess this doesn't solves my problem. Anyway, thanks.

~Nik.
 
RPC is not a good idea if it has to go over the internet. RPC (like telnet and regular FTP) is sent in plain text and your passwords can be sniffed.

SSH is better solution.

If your comparing performance, use the time command on each machine instead of trying guesstimate by running them at the same time.

The question your asking isn't a programming question about C, it's a question about the network technologies Unix has available. Try the Unix forum for this type of question.

You'll have to first sftp the program to the other server then use ssh into it and run it.

[plug=shameless]
[/plug]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top