1832902 Members
2365 Online
110048 Solutions
New Discussion

Rexec command problem

 
subrata  Sur
Frequent Advisor

Rexec command problem

I m writing the script using the rexec like that ..

#!/bin/ksh

logfile=send_item_master_to_gemms.log
DX_ITEM_path=/db_spd_sheet/sci/dx
dmp_path=/users/nmxbatch/subrata
remote_path=/home/nmxbatch/subrata


exec $dmp_path/connect_gemp022p $remote_path/load_ITEM_MASTER.sh

echo "Completing loading of DX.ITEM.csv into ITEM_MASTER GEMMS Server" >> ${dmp_path}/$logfile
echo `date` >> ${dmp_path}/$logfile
rcp -p nmxbatch@gemp022p:/home/nmxbatch/subrata/load_DX.ITEM.log /users/nmxbatch/subrata/
echo $dmp_path >>${dmp_path}/$logfile
ls -lrt load_DX.ITEM.log>>${dmp_path}/$logfile
cd $dmp_path
cat load_DX.ITEM.log >>${dmp_path}/$logfile

echo `date` >> ${dmp_path}/$logfile
echo "End of Loading DX.ITEM.csv into ITEM_MASTER GEMMS Server" >> ${dmp_path}/$logfile

and the load_ITEM_MASTER.sh script is attached which is executing on the remote server
#---------------------

Problem is through rexec command i can execute the load_ITEM_MASTER.sh on remote server But after that it is exiting and not able to execute after that rexec comand . Still not able to understand why it is behaving like this .
6 REPLIES 6
harry d brown jr
Honored Contributor

Re: Rexec command problem

Are you sure you posted your script properly?

You have an "exec" and not an "rexec"

live free or die
harry d brown jr
Live Free or Die
subrata  Sur
Frequent Advisor

Re: Rexec command problem

The script coonect-gemp022p is used for connecting to the remote server
and calling the script which is passed as parameter where i have use the rexec command .

#include
#include
#include
#include
#include
#include

char *host[] = { "gemms" };
char *user = "nmxbatch";
char *passwd = "nmxbatch";
char *cmd = "";

/* remsh uamtv005 . .profile 2>&- \; test.prg */

main(argc, argv)
char **argv;
int argc;
{
char ch;
struct servent *servent;
FILE *fp;
int sd;

servent = getservbyname("exec", "tcp");
sd = rexec(host, servent->s_port, user, passwd, argv[1], 0);
fp = fdopen(sd, "r");
while ((ch = getc(fp)) != EOF)
putchar(ch);
}

subrata  Sur
Frequent Advisor

Re: Rexec command problem

Guessing the problem in load_item_master script

Need help on this issue as the script is exiting after executing this line

exec $dmp_path/connect_gemp022p $remote_path/load_ITEM_MASTER.sh
harry d brown jr
Honored Contributor

Re: Rexec command problem

exec $dmp_path/connect_gemp022p $remote_path/load_ITEM_MASTER.sh

Will never return to the script that called it and the script that called exec will terminate.

You just need to remove the "exec " from the beginning of that line:

$dmp_path/connect_gemp022p $remote_path/load_ITEM_MASTER.sh

If you want it to run in the background and not wait, then issue:

$dmp_path/connect_gemp022p $remote_path/load_ITEM_MASTER.sh &

or

nohup $dmp_path/connect_gemp022p $remote_path/load_ITEM_MASTER.sh &


live free or die
harry d brown jr
Live Free or Die
subrata  Sur
Frequent Advisor

Re: Rexec command problem

Trying it after removing the exec command But still getting the same error .. It is exiting fter sqlloder .

Any idea ...
harry d brown jr
Honored Contributor

Re: Rexec command problem

Can you post the output and error messages?

and

identify what you changed?

live free or die
harry d brown jr
Live Free or Die