UNIX SILENT VALUE(rlogin ...)

Serge

New Member
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??
 

TomBascom

Curmudgeon
You should look into "ssh". It is far more modern (and secure) than the "r" commands and ftp. Scripting this sort of stuff is a lot easier too.
 

Cecil

19+ years progress programming and still learning.
I think you could just use an AppServer (if you got one). Create a new generic Client and Server .p files and have the Server.p file on the target machine (the one with the database).

Then transfer the yournewprocedure.p file over the network via AppServer connection by using the Server.p procedure.

The Client.p and Server.p file would be used the handle the file transfer. Also the Client.p would be also used to execute the RUN yournewprocedure.p ON server.

Simple.

This could be a nice little project and could become even more powerful. Thinking about it more you could even you WebSpeed instead of a AppServer.

PLUS! You have got cross platform compatible across OS.
 

Serge

New Member
Thx for replies guys, but I'll keep it simple and thus try TomBascom's solution.

I've generated a public key (ssh-keygen -t rsa1) on the local machine and copied it to the remote machine (~/.ssh/authorized_keys).

Still when I want to ssh or scp to the remote machine, it is prompting for a password??

Somebody any idea why?
 

Serge

New Member
Problem Solved!

Just make sure the public key in the file "authorized_keys" on the remote machines = 1 rule. You can see this by opening the file with pico.
 
Top