Saturday, November 19, 2011

Solaris: using nc and tar to transfer file between hosts

If you can't find a way for the controllers to talk to each other (as others have mentioned), you can try doing this:
On your destination server, run the following command:
destination-server# nc -l 9999 | tar xvzf -
Then, on your source server, run the following command:
source-server# tar cvzf -  | nc destination-server-ip 9999
The advantage to this is it avoids any encryption overhead that SSH/rsync gives, so you'll get a bit of a speed boost. This also compresses and decompresses on the source and destination servers in-stream, so it speeds up the transfer process at the expense of some CPU cycles.

CLIENT/SERVER MODEL

It is quite simple to build a very basic client/server model using nc.
     On one console, start nc listening on a specific port for a connection.
     For example:

           $ nc -l 1234

     nc is now listening on port 1234 for a connection.  On a second console
     (or a second machine), connect to the machine and port being listened on:

           $ nc 127.0.0.1 1234

     There should now be a connection between the ports.  Anything typed at
     the second console will be concatenated to the first, and vice-versa.
     After the connection has been set up, nc does not really care which side
     is being used as a `server' and which side is being used as a `client'.
     The connection may be terminated using an EOF (`^D').

   

No comments:

UNIX: How to print column nicely using printf

[user@hostfwnms1-oam tmp]# cat b.sh printf "%-26s %-19s %-8s %-8s %-s %-s\n" HOSTNAME IP PING SNMPWALK 0-ok 1-fail for i in `cat n...