Tell me more ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

Thanks CDN module, I could set up a remote server as my private cdn for image files, so that all the /files/u*/*.gif&jgp are being severed from the remote server. However I have problem using rsync to synchronize user files between servers.

Here is the script that I use:

#!/bin/bash

RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
KEY=/home/webuser/cron/thishost-rsync-key
RUSER=webuser
RHOST=cdn.mysite.com
RPATH=/webroot/cdn/sites/default/files/  
LPATH=/webroot/sites/default/files/  


$RSYNC  --ignore-existing -avh  --exclude 'advagg*' --exclude 'css' --exclude 'js'  -e "$SSH -i $KEY" $RUSER@$RHOST:$RPATH $LPATH

However the script fails to copy new files uploaded by individual users to the remote server. To cope with this problem, and say copy new files uploaded by user123 to the remote server, I need to specify the path to user's files he script, i.e.

/webroot/cdn/sites/default/files/u123/ & 

instead of

/webroot/cdn/sites/default/files/

which is clearly not a solution when there are hundreds of users.

The rsync is supposed to go recursively and copy over files, but it does not behave as expected. I have tried many different rsync flags with no avail and got really frustrated. So appreciate your hints about this.

share|improve this question

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.