利用rsync备份邮件系统

主服务器

vi /etc/rsyncd.conf

#motd file = /etc/rsyncd.motd    
hosts allow = 1.1.1.2      
hosts deny =1.1.1.0/24      
use chroot = no      
max connections = 4      
strict modes = yes      
port = 873      
pid file = /var/run/rsyncd.pid      
lock file = /var/run/rsync.lock      
log file = /var/log/rsyncd.log      
#define dirctory for rsync      
[zimbra]      
path = /opt/zimbra/      
comment = zimbra's directory from 1.1.1.2      
auth users = zimbra      
uid = root      
gid = root      
secrets file = /opt/rsyncd.pwd      
read only = no      
list = no

vi /opt/rsyncd.pwd #同步密钥文件

输入 :zimbra:zimbra 保存退出

chmod 400 /opt/rsyncd.pwd

chmod 600 /etc/rsyncd.conf

/usr/bin/rsync --daemon /etc/rsyncd.conf

备份服务器

vi /opt/rsyncd.pwd

chmod 400 /opt/rsyncd.pwd

nohup rsync -avzp --delete --progress --password-file=/etc/rsyncd.pwd [email protected]::zimbra /opt/zimbra/ &>/opt/rsync.log&

定时执行

crontab -e

* * * */12 * nohup rsync -avzp --delete --progress --password-file=/etc/rsyncd.pwd [email protected]::zimbra /opt/zimbra/ &>/opt/synclog&

你可能感兴趣的:(File,服务器,邮件系统)