• Welcome to XF2 Addons

    You can purchase a Premium membership for only $35 per year, and this gives you access to download any or ALL of the over 400 add-ons developed for Xenforo 2.x. In addition, Premium members will get technical support. Once the Premium membership has expired you can continue to use the installed addons on your forum as long as you like.

How to use rsync

Andy

Administrator
Staff member
Making backups on a Mac is easy with rsync. Follow these instructions to backup your forum from web host server to your Mac.

The follow four commands are run when you log into your terminal as root. Each command will ask for your root password.

The -p 2200 may not be needed, I use it because KnownHost requires it.

The 123.123.123.123 you will change this to your IP address.

The /home/username/public_html/ will be the path to your XenForo directory.

The /Volumes/Ext1/internal_data will be the path to your external device on your Mac.

Code:
rsync -av --delete --rsh='ssh -p 2200' 'root@123.123.123.123:/home/username/public_html/internal_data/attachments' /Volumes/Ext1/internal_data

rsync -av --delete --rsh='ssh -p 2200' 'root@123.123.123.123:/home/username/public_html/data/avatars' /Volumes/Ext1/data

rsync -av --delete --rsh='ssh -p 2200' 'root@123.123.123.123:/home/username/public_html/src/addons' /Volumes/Ext1/data

rsync -av --delete --rsh='ssh -p 2200' 'root@123.123.123.123:/home/username/mysql_backups/backup.sql' /Volumes/Ext1/mysql_backups
 
The trailing slash in rsync commands has different effects on the source and destination paths.

Source:
  • A trailing slash on the source path tells rsync to copy the contents of the directory, rather than the directory itself.
  • Without a trailing slash on the source path, rsync will copy the directory itself, along with its contents.
Destination:
  • A trailing slash on the destination path does not make a difference, as long as the destination is a directory. If the destination does not exist, rsync will create it.
For example, the following two commands will copy the contents of the directory /src/foo to the directory /dest/:

rsync -av /src/foo /dest/
rsync -av /src/foo/ /dest/
However, the following two commands will have different results:

rsync /src/foo /dest/foo
rsync /src/foo/ /dest/foo
The first command will copy the directory /src/foo to the file /dest/foo. The second command will copy the contents of the directory /src/foo to the directory /dest/foo.

It is generally recommended to use a trailing slash on the source path of rsync commands, to avoid any ambiguity.
 
Regarding the creation of directories, rsync will only create directories which are contained in the destination directory defined. In other words it will not create base directories.
 
Back
Top