Hi,
I've got multiple UNIX servers with similar databases structures + file structures. Sometimes it happens that I need to run one procedure on all the servers locally (performance). For the moment I always do next;
1. ftp the .p file from the source server to the destination servers,
2. login remotely to the destination servers,
3. run the procedures on the destination servers
4. ftp the output files from the dest server to the source server
As you can see, when I need to do this for e.g. 10 servers, it takes a long time, even if it is always the same. Therefore I wrote a procedure where I can input a 'procedure name.p' + select the servers I want to run the procedure on.
DEF VAR vProcedure AS CHAR FORMAT "x(50)" NO-UNDO INIT "test.p".
DEF VAR vOutputFile AS CHAR FORMAT "x(50)" NO-UNDO INIT "test.txt".
/* FTP the procedure to the server where it has to run */
UNIX SILENT VALUE("rcp /root/" + vProcedure + " SERVER2:" + vProcedure).
UNIX SILENT VALUE("rlogin SERVER2")
RUN VALUE("/root/" + vProcedure + "(INPUT " + vOutputFile + ")").
UNIX SILENT VALUE("cd /root").
UNIX SILENT VALUE("rm " + vProcedure).
UNIX SILENT VALUE("rcp " + vOutputFile + " reynint:" + vOutputFile).
UNIX SILENT EXIT
This procedure is working until the remote login. When it comes there it just shows me the prompt of SERVER2 [root@server2 root]# and waits until I type something.
Is it possible to run UNIX commands programmatically on the remote system??
I've got multiple UNIX servers with similar databases structures + file structures. Sometimes it happens that I need to run one procedure on all the servers locally (performance). For the moment I always do next;
1. ftp the .p file from the source server to the destination servers,
2. login remotely to the destination servers,
3. run the procedures on the destination servers
4. ftp the output files from the dest server to the source server
As you can see, when I need to do this for e.g. 10 servers, it takes a long time, even if it is always the same. Therefore I wrote a procedure where I can input a 'procedure name.p' + select the servers I want to run the procedure on.
DEF VAR vProcedure AS CHAR FORMAT "x(50)" NO-UNDO INIT "test.p".
DEF VAR vOutputFile AS CHAR FORMAT "x(50)" NO-UNDO INIT "test.txt".
/* FTP the procedure to the server where it has to run */
UNIX SILENT VALUE("rcp /root/" + vProcedure + " SERVER2:" + vProcedure).
UNIX SILENT VALUE("rlogin SERVER2")
RUN VALUE("/root/" + vProcedure + "(INPUT " + vOutputFile + ")").
UNIX SILENT VALUE("cd /root").
UNIX SILENT VALUE("rm " + vProcedure).
UNIX SILENT VALUE("rcp " + vOutputFile + " reynint:" + vOutputFile).
UNIX SILENT EXIT
This procedure is working until the remote login. When it comes there it just shows me the prompt of SERVER2 [root@server2 root]# and waits until I type something.
Is it possible to run UNIX commands programmatically on the remote system??