Solved

Remote Execution

Posted on 1998-09-29
7
216 Views
Last Modified: 2013-12-26
Is there and easy way to execute a program on a unix machine
from within a c++ program on another unix machine?
Basically I have an X windows program that needs to open an
X Display that runs on another machine?
Thanks
0
Comment
Question by:soucy
  • 3
  • 3
7 Comments
 
LVL 2

Expert Comment

by:mlev
ID: 1293460
I think your best bet would be system("rsh ...")
(or fork() + execlp("rsh", ...))
If you want to work harder, you might write a daemon
to run on the remote machine, wait for connection from
your program and then launch something.
0
 
LVL 3

Expert Comment

by:braveheart
ID: 1293461
mlev's suggestion looks good to me. Don't forget to use xhost appropriately to set permissions for the display on which the client will run.
0
 
LVL 1

Accepted Solution

by:
vulkanr earned 10 total points
ID: 1293462
if i understood your question correctly,
mlev is wrong. rsh will work on a workstation but if your
client is a X-TERM or a PC running some kind of X-emulator,
rsh is useless.
i suggest you "setenv" the DISPLAY enviroment variable to the
address of the remote machine client. (use putenv from within your program). then, every X program you will run will write
its output to the display of the remote machine.

0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 2

Expert Comment

by:mlev
ID: 1293463
vulkanr, read the question carefully: "...a program on a unix[!] machine from within a c++ program on another unix[!] machine."

0
 
LVL 1

Expert Comment

by:vulkanr
ID: 1293464
mlev, sure its a unix machine, but the problem described, is opening a display (A x-client), not running a remote program.

however, the answer i suggested would run over the local server.
i guess the right answer will be a combined one,
set the DISPLAY variable, then "rsh" to the remote server, and execute the desired program.

0
 
LVL 1

Expert Comment

by:vulkanr
ID: 1293465
mlev, sure its a unix machine, but the problem described, is opening a display (A x-client), not running a remote program.

however, the answer i suggested would run over the local server.
i guess the right answer will be a combined one,
set the DISPLAY variable, then "rsh" to the remote server, and execute the desired program.

0
 
LVL 2

Expert Comment

by:mlev
ID: 1293466
More like rsh to the remote server, set DISPLAY there, and execute it. Or execute it with -display option or whatever.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
cat dog challenge 18 122
Expand to include initial dialog with two choices. 9 59
viewing source code from eclipse 13 74
canBalance challenge 34 65
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now