Welcome to Abdul Malik Ikhsan's Blog

Rsync : Synchronize local with shared hosting

Posted in Teknologi, tips and tricks by samsonasik on January 26, 2013

rsyncAs web developer, We already realize that we are lazy. Our client is often only have shared hosting, not dedicated server that we can install version control which simplify push and pull. We often forgot to upload some file we changed/added in local to shared hosting, and it make web is not run properly in shared hosting.  The solution is to use rsync in local PC.  Rsync is a file transfer program for Unix systems. rsync uses the ‘rsync algorithm’ which provides a very fast method for bringing remote files into sync. An important feature of rsync not found in most similar programs/protocols is that the mirroring takes place with only one transmission in each direction. Rsync can copy or display directory contents and copy files, optionally using compression and recursion.
So, you need to know the step to do this :
1. Go to your Cpanel
2. Click Ftp Account
Screen Shot 2013-01-26 at 4.36.40 PM
3. Click Configure FTP Client in your desired user
Screen Shot 2013-01-26 at 4.39.14 PM

And see the SFTP Port. Use the port to in rsync port target transfer.
4. Start syncing…

cd ~/www && rsync -timeout=50000 -av --exclude ".git" --exclude ".gitignore" --exclude "wp-config.php"  wordpress_local_dev/ -e "ssh -p 2223" yourremoteserveruser@yourdomain.com:/home/yourremoteserveruser/public_html/

The option –exclude will exclude unneeded to sync.
The option -timeout is what second to be connection to timeout.
And you will see the following ( just updated / added file will be uploaded ) :

5. Done !

References :
Image : http://www.haykranen.nl/wp-content/uploads/2008/05/timemachine.jpg
Source :
1. http://mike-hostetler.com/blog/2007/12/08/rsync-non-standard-ssh-port/
2. http://en.wikipedia.org/wiki/Rsync

6 Responses

Subscribe to comments with RSS.

  1. Kumar said, on September 3, 2013 at 8:43 pm

    Hi sir,
    As I am a beginner, I was not able to install Zend framework on my machine?
    Can you Post the steps to install zend?
    Thank You….

  2. Kumar said, on September 4, 2013 at 11:29 am

    Thank You Sir

  3. Raja said, on September 4, 2013 at 1:22 pm

    Hi sir,
    Can you Post the sample code to integrate V.me checkout(Visa payment) in php? I was so confused to integrate this.
    Thank you

  4. Mike said, on January 12, 2014 at 2:44 am

    Very good article on rsync. Here is one from around 1999 but still the very best rsync tutorial I’ve ever read. Explains it very well IMO: http://tinyurl.com/l37guv8

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: