Use the rsync to back up all files

Here is the scripts:

rsync --progress --avze ssh --delete srcDir/  remoteName@remoteMachine:remoteDir/

-a quick way to specify the recursion and preserve everything.
-v verbose
-z compress

And then change ssh with no password:
Create the private keys for local machine:
ssh-keygen -t dsa
Copy the local keys to remote machine:

ssh-copy-id -i ~/.ssh/id_dsa.pub remoteuser@remotebox
Do not set the password.

After that, add an alias into your .bashrc
alias bp='. ~/backup.sh'
So you can run bp directly to backup all things.
Over ~~~

你可能感兴趣的:(Use the rsync to back up all files)