rsync -av /Folderl/ /backup2/backup/Folder
nice -n 10 /usr/bin/rsync
rsync 是個很有用的工具,可以拿來同步兩台電腦間的資料。不過 rsync 有一個大問題就是:如果兩台電腦的語系不同的話,那就會造成困擾。像是 Mac OS X 都是用 UTF-8,而 FreeBSD 的 Server 上用 big5 已經用很久了也不太方便換,如果直接 rsync 那就一定有一邊看到亂碼。真的要用的話那就只能繞路了。之前處理的方式是用 samba 轉一層 mount 之後再做 rsync,利用 samba 來轉換,可以正常運作,不過花了很大的力氣。
Method | rsync,2,3, | |||||||||||
sing machine local file to local file | rsync [option]... source [source]...Dest rsync --delete -av /sourceDirectory/subDirectory /targetDirectory | |||||||||||
Local to Remote | rsync [option]... Source [Source]... [user@]host:Dest rsync [option]... Source [Source]... [user@]host::Dest | |||||||||||
Remote to Local | rsync [option]... [user@]host::Source [Dest] rsync [option]... [user@]host:SourceDest rsync [option]... rsync://[user@]host[:PORT]/Source [Dest] | |||||||||||
ssh | rsync -av -e ssh user@rsh.server:/sourceDirectory /targetDirectoryssh-keygen -t rsa # hit return three times ssh-copy-id -i ~/.ssh/id_rsa.pub username@remote_host # enter your password for username on remote_host cat > /etc/cron.daily/remote_backup #!/bin/sh rsync -e 'ssh -p 22' -avzp /some/dir remote_host:/var/backups/some_host ^D chmod +x /etc/cron.daily/remote_backup ssh username@remote_host mkdir /var/backups/some_host | |||||||||||
daemon |
|
[root@linux etc]# cat /var/spool/cron/root
#05 17 * * * poweroff
01 * * * * /etc/singtime
#43 0 1 * * /etc/backup
1 1 1 * * /etc/mthBackup
59 01 * * * rsync -av --delete --exclude "*.exe" --exclude "*.EXE" /ssole/folder/ /current/sole/folder/
#59 03 * * * rsync -av --delete --exclude "*.EXE" --exclude "*.exe" /folder/subFolder/ /current/folder/subFolder/
59 22 * * * rsync -av --delete /sFolder/subFolder/ /current/folder/subFolder/
10 1 * * * rsync -av --delete /boot/ /243d/sa/it/linux/2/boot
20 1 * * * rsync -av --delete /root/ /243d/sa/it/linux/2/root
30 1 * * * rsync -av --delete /etc/ /243d/sa/it/linux/2/etc
40 1 * * * rsync -av --delete /var/spool/cron/ /243d/sa/it/linux/2/var/spool/cron
#05 17 * * * poweroff
01 * * * * /etc/singtime
#43 0 1 * * /etc/backup
1 1 1 * * /etc/mthBackup
59 01 * * * rsync -av --delete --exclude "*.exe" --exclude "*.EXE" /ssole/folder/ /current/sole/folder/
#59 03 * * * rsync -av --delete --exclude "*.EXE" --exclude "*.exe" /folder/subFolder/ /current/folder/subFolder/
59 22 * * * rsync -av --delete /sFolder/subFolder/ /current/folder/subFolder/
10 1 * * * rsync -av --delete /boot/ /243d/sa/it/linux/2/boot
20 1 * * * rsync -av --delete /root/ /243d/sa/it/linux/2/root
30 1 * * * rsync -av --delete /etc/ /243d/sa/it/linux/2/etc
40 1 * * * rsync -av --delete /var/spool/cron/ /243d/sa/it/linux/2/var/spool/cron
沒有留言:
張貼留言