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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Executable file on PC to be run from Solaris ???? 1

Status
Not open for further replies.

NavinB

Technical User
Apr 11, 2001
277
GB
Hi All,
Is there any utility or command or a script that I can run from my solaris box to run an executable file lying on my PC(Win 2000)?The software for this exe file is on my PC so I can't ftp this file to my server and run that on the server.
Any help would be appreciated?
Thanx....
 
You could try VNC, it's free and easy to find on the web.
It can transfer a PC desktop in to a window on your Sun monitor.
The output from your .exe file would still be on the PC.
 
Hi All,
There's one rexecd daemon with which we can run Windows applications from Unix prompt.But the command which provides this link is 'rexec'.I don't have it on my server.Does anybody know where I can find the source code for rexec command for solaris.
Any help would be appreciated....
Thanx.....
 
as far as I know "rexecd" is the server for rexec routine, this is controled via "/etc/inetd.conf" this used by Xserver running on PC like Hummingbird eXceed, you can use
"rexec" system call on a C program, following is a very simple example:

main(argc,argv)
char *argv[];
int argc;
{
char *host = "hostname";
char *passwd = "password";
char *user = "userid";
char *cmd = "setenv DISPLAY hostname:0.0; /usr/openwin/bin/xterm &";
int fd2p = 0;
unsigned short port = 512;
int result;

result = rexec(&(host),port,user,passwd,cmd,fd2p);

printf("Return from rexec %d\n", result);
}

Hope this helps.

Regards,

Carlos Almeida,

 
Hi Carlos,
I tried compiling the above program but I'm facing some error.It says undefined symbol rexec.Could u please tell me where and how do I declare "rexec"?
Thanks.....
 
"rexec" is in "socket" library, so i.e if you call your program "test.c" and use gcc compiler you must compile with:

gcc test.c -lsocket -o test

Kind Regards,

Carlos Almeida,

 
Hi Carlos,
I included the file netdb.h which has a reference for rexec
in the C program but still I'm getting error.Below is the error:

rexec.c: In function `main':
rexec.c:15: warning: passing arg 6 of `rexec' makes pointer from integer without
a cast
Undefined first referenced
symbol in file
rexec /tmp/ccvPB15X.o
ld: fatal: Symbol referencing errors. No output written to a.out

Could u throw any light on this please....
 
do you try to compile the program using:
"gcc test.c -lsocket -o test" ? it shoud work ...

KindRegards,

Carlos Almeida.
 
Hi,
The source code is in test.c and following is the code:
#include "stdio.h"
#include "netdb.h"
main(argc,argv)
char *argv[];
int argc;
{
char *host = "hostname";
char *passwd = "password";
char *user = "userid";
char *cmd = "setenv DISPLAY hostname:0.0; /usr/openwin/bin/xterm &";
int fd2p = 0;
unsigned short port = 512;
int result;
result = rexec(&(host),port,user,passwd,cmd,fd2p);
printf("Return from rexec %d\n", result);
}

Following is the o/p:
#/usr/local/bin/gcc test.c -lsocket -o test
test.c: In function `main':
test.c:15: warning: passing arg 6 of `rexec' makes pointer from integer without
a cast

Any idea why this is happening?

Thanx....
 
It's just a warning but it compiles okay, if you remove the line "#include "netdb.h"" or change rexec line to:
result = rexec(&(host),port,user,passwd,cmd,(int *)fd2p);
it compiles without warnings.


Regards,

Carlos Almeida,
 
Hi Carlos,
Thanks ......it has compiled successfully and I am able to execute it also but the command doesn't show me the o/p but it returns a code 4.What it that supposed to be ?I am able to successfully run the cmd by giving hostname of another Sun server but it is not able to execute the cmd on windows-NT platform.Any idea.....(Actually I want to execute an app on windows from my sun server)
Thanks.....
 
Sorry, do you want to run a command from you Solaris Box that execute a program in a Windows NT ? sorry for asking but why do you want to do that ?

Regards,

Carlos Almeida,
 
Hi Carlos,
Actually,there are 2 applications which I need to run.The first one runs on solaris box and immediately after the completion of that, I want to run the second application(which works in Win NT).So I have written a script which sends a signal to the solaris box that the first app has completed and then with rexec command I want to run the second app from that script,so that there is no manual intervention or time lag between two applications.
Any help would be appreciated.....
Thanks....
 
Okay, may be an easy way to do that is when Solaris application ends writes a file (status ok), to a directory exported from the NT machine (with samba, or something similar), on NT run a simple script to check time to time if Solaris app already finished by checking that file in a loop, if so remove the file and run NT app. If you don't want complicate by using samba you can also use "ftp" to put status okay file in the NT machine.

Hope this helps,

Carlos Almeida,
 
Well ,I had been thinking of that only(using Task Scheduler on NT to run the application) but then I found rexec command and I thought it would be simple if I could run the second app from solaris box.
Ok then I'll use NT option now but do u have any idea whether rexec works from (solaris-to-NT)??
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top