The -v flag (for verbose) is also necessary to get the appropriate output: rsync -anv dir1/ dir2 Rsync provides a method for double-checking your arguments before executing an rsync command. Output numbers in a human-readable format. Omit this flag if you want faster backups, but files without changes in modified time or size won't be detected for include in backup. Skip based on checksum, not mod-time & size. activates recursion into the folders and preserve all file’s metadata The cron script runs as the root user.Īrchive mode equals -rlptgoD (no -H,-A,-X). In the above example the script runs twice a day, once at 10.00 hrs and another run takes place at 20.00 hrs. Make sure to adjust the schedule to meet your requirements. 00 10,20 * * * root rsync -av -delete -bwlimit 50000 -exclude 'exlude/folder/of/choice*/' -log-file=/home/rsync-backup-log-$(date +"%Y-%m-%d").log -e 'ssh -p 22' /destination/folder/ Navigate to the /etc/cron.d/ folder, create a file named backup-cron and paste the contents of the rsync script that we created earlier and with the cron schedule configured. rsync -av -delete -bwlimit=50000 -exclude 'backup*/' -log-file=/home/rsync-backup-log-$(date +"%Y-%m-%d").log -e 'ssh -p 22' /destination/folder/ Additionally a bandwidth limit has been set and a folder named "backup" on the source folder is ignored and thus not synchronized. It synchronizes this data with the local folders that have been configured. The example below sets up Rsync to pull data from a remote server. This may come handy if you do not allow password authentication for SSH on your destination server. Or you can manually copy and paste the contents of /root/.ssh/id_rsa.pub that you just generated on the destination server to the /root/.ssh/authorized_keys file on the source server. ssh-copy-id -i ~/.ssh/id_rsa.pub ip.of.data.source copy public key to the server that is the source of your data. ssh-keygenĮnter passphrase (empty for no passphrase):Ģ. This is the method that we recommend, the push method has a number of security implications that need to be considered. Generate a public and private key pair on the destination server, the server from where you are pulling your backup data. In this guide we will explain how to setup and automate an Rsync script that pulls data from the source to the destination. It provides fast incremental file transfer by transferring only the differences between the source and the destination. Rsync is a fast and versatile command line utility that synchronizes files and folders between two locations over a remote shell, or from/to a remote Rsync daemon.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |