I have two ubuntu servers and will be using a script (although I have not written it yet) on the sending server to send file abcd.txt whenever it changes using:
nc 10.10.10.4 3333 < abcd.txt
On the listening server I am using the
-k option to keep it continuously listening:
nc -k -l 3333 > /home/abcd.txt
My goal is to have the file on the listening server be overwritten every time the sending server sends a file. This is not happening. Instead the entire file gets appended resulting in duplicated lines. Is there a way to fix this? I am open to options either than using netcat.
Also note, I cannot use a sort or uniq command to change the abcd.txt once it gets to the listening server due to the files being extremely large and timing constraints being imposed. (We will likely have the file on the sending end rolling every 60 seconds or so.)