Use the rsync to back up all files

Posted on 2010-11-15 14:22 MichaelCao 阅读(241) 评论(0)  编辑 收藏 引用 所属分类: Small things
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 ~~~

只有注册用户登录后才能发表评论。
网站导航: 博客园   IT新闻   BlogJava   知识库   博问   管理


posts - 16, comments - 16, trackbacks - 0, articles - 0

Copyright © MichaelCao