rsync on freebsd

环境(1):
服务器IP:192.168.3.204
客户机IP:192.168.3.250
效 果:5分钟对服务器的samba(/usr/samba)目录做一次备份到192.168.0.214的/usr/samba目录.
服务器配置(192.168.3.204):
cd /usr/ports/net/rsync/
make install clean
[X] POPT_PORT Use popt from devel/popt instead of bundled one
[X] SSH Use SSH instead of RSH
[ ] FLAGS File system flags support patch, adds --fileflags
[ ] ATIMES Preserve access times, adds --atimes
[X] ACL Add backward-compatibility for the --acls option
[X] ICONV Add iconv support
[X] TIMELIMIT Time limit patch
vi /etc/rc.conf
rsyncd_enable="YES"
rsyncd_flags="--config=/usr/local/etc/rsyncd.conf"
:wq
vi /usr/local/etc/rsyncd.conf
pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
uid = root
gid = wheel
use chroot = yes
max connections = 4
syslog facility = local5
[mail]
path = /usr/home/domains
comment = Must Auth Mirror
ignore errors
read only = yes
list = no
auth users = unixnotes
secrets file = /usr/local/etc/rsync.passwd
[mysql]
path = /var/db/mysql/srcmail
comment = Must Auth Mirror
ignore errors
read only = yes
list = no
auth users = unixnotes
secrets file = /usr/local/etc/rsync.passwd
[samba]
path = /usr/home/samba
comment = Must Auth Mirror
ignore errors
read only = yes
list = no
auth users = unixnotes
secrets file = /usr/local/etc/rsync.passwd
:wq
vi /usr/local/etc/rsync.passwd
yourusername:yourpassword
:wq
chmod 600 /usr/local/etc/rsync.passwd
/usr/local/etc/rc.d/rsyncd start

客户端配置(192.168.3.250):
cd /usr/ports/net/rsync/
make install clean
[X] POPT_PORT Use popt from devel/popt instead of bundled one
[X] SSH Use SSH instead of RSH
[ ] FLAGS File system flags support patch, adds --fileflags
[ ] ATIMES Preserve access times, adds --atimes
[X] ACL Add backward-compatibility for the --acls option
[X] ICONV Add iconv support
[X] TIMELIMIT Time limit patch
#vi /etc/rc.conf
#rsyncd_enable="YES"
#rsyncd_flags="--config=/usr/local/etc/rsyncd.conf"
#:wq
vi /usr/local/etc/rsync.passwd
yourpassword
:wq
chmod 600 /usr/local/etc/rsync.passwd
vi /usr/local/bin/backupmail
#!/bin/sh
/usr/local/bin/rsync -qzrtopg --delete [email protected]::mail /usr/home/domains --password-file=/usr/local/etc/rsync.passwd
:wq
vi /usr/local/bin/backupmysql
#!/bin/sh
/usr/local/bin/rsync -qzrtopg --delete [email protected]::mysql /var/db/mysql/postfix --password-file=/usr/local/etc/rsync.passwd
/usr/local/etc/rc.d/mysql-server restart
:wq
chmod +x /usr/local/bin/backupmail
chmod +x /usr/local/bin/backupmysql
vi /etc/crontab
56 17 * * * root /usr/local/bin/backupmail
56 05 7 * * root /usr/local/bin/backupmysql
:wq
#########################################################################################
#本机rsync
bash-2.05b# more rsyncdate.sh
#/bin/sh
/usr/local/bin/rsync -qzrtopg --delete /var/db/mysql/ /backup/mysql
#/usr/local/bin/rsync -qzrtopg --delete /usr/samba/ /backup/samba
#/usr/local/bin/rsync -qzrtopg --delete /usr/home/ /backup/mail
:wq

mount_smbfs -I 192.168.1.201 //administrator@FTP-Srv/serv-u /andytest