Presuming that you already have setup a rsync connection and permissions with ssh keys here is an useful piece of snippet that can help you synchronize folders faster. A real example where I use it is while I am migrating an old server to a new one where: files keep changing on the old server while the process from account managers and project managers takes time till they validate each web site or app that has been transferred successfully.
#!/bin/bash echo Syncronizing files from old to new host for marianzburlea.com RSYNC=/usr/bin/rsync SSH=/usr/bin/ssh KEY=/var/www/vhosts/rsynckey REMOTEUSER=root REMOTEHOST=www.marianzburlea.com folders=("clients" "gamerbreed" "drupal6testing" "drupal7testing" "drupal8testing" "yii" "dev" "testing" "work") for i in "${folders[@]}" do : echo "***************************************************" echo Syincronizing $i folder echo "***************************************************" REMOTEPATH=/var/www/vhosts/marianzburlea.com/subdomains/$i/ LOCALPATH=/var/www/vhosts/marianzburlea.com/_subdomains/$i/ $RSYNC -avz -e "$SSH -i $KEY" $REMOTEUSER@$REMOTEHOST:$REMOTEPATH $LOCALPATH done
Comments
Ok, super , chiar căutăm ceva
Add new comment