I need to:
1: compare server1:/data/archive/ to server2:/data/archive/ (through rsync, ssh, etc)
2: filenames that don't match, get copied (scp) to server2:/data/
server1 and server2 have ssh, scp, rsync access between eachother.
Is there any option in rsync to check/compare server1:/data/archive/ to server2:/data/archive/ and have the files synced to another destination such as server2:/data/ ??
This assumes you set up ssh keys for the user in question
ssh server1 'cd /data/archive && ls | cksum | grep -v -i directory' > server1.lis
ssh server2 'cd /data/archive && ls | cksum | grep -v -i directory' > server2.lis
awk '{arr[$0]++} END{ for (i in arr){if(arr==1){print arr} } }' server1.lis server2.lis >uniq.txt
This gives you a list of files that are different, either in content and/or in name.
You can then scp the files to server3. I'm tired right now so I will opt for not worrying about failures
too much.
awk '{print $(NF)}' uniq.txt |
while read fname
do
scp server1:/data/archive/${fname} server3:/data/archive/${fname} ||
scp server2:/data/archive/${fname} server3:/data/archive/${fname}
done < uniq.txt
PS: rsync can do a compare and not move files. But, it cannot sync to a third directory based on files not existing in duplicate directories somewhere else.