日期:2014-05-16 浏览次数:20773 次
[jay@B ~]$ rpm -qa| grep rsync rsync-2.6.8-3.1
rsync 873/tcp # rsync rsync 873/udp # rsync
log file = /var/log/rsyncd.log [local0] path=/home/jay/backup-A comment = backup from server A hosts allow = 10.0.0.1/8 127.0.0.1 read only = false uid = 500 # 保证在B服务器的备份操作以jay这个用户进行 gid = 500 #
disable = no
/etc/init.d/xinetd restart
rsync localhost::
root@A#ssh-keygen -t rsa Generation public/private rsa key pair. Enter file in which to save the key(/root/.ssh/id_rsa): Enter passphrase(empty for no passphrase): Enter same passphrase again: Your identiflcation has been save in /root/.ssh/id_rsa. Your public key has been saved in /root/.ssh/id_ras.pub. The key fingerprint is: c3:a0:de:f8:24:8e:f6:0d:ed:0a:b0:a2:2d:aa:d3:8b root@A
root@A#ssh jay@10.0.0.2 ... jay@B$mkdir .ssh;chmod 0700 .ssh
root@A#scp .ssh/id-rsa.pub 10.0.0.2: /home/jay/.ssh/authorized_keys
#!/bin/sh TARGET_DIR=backup-A for SOURCE_DIR in "/var/lib/mysql" "/home" do echo "Backing up $SOURCE_DIR ..." rsync -au --delete $SOURCE_DIR jay@10.0.0.2:/home/jay/$TARGET_DIR done
root@A#crontab -e
0 4 * * * /etc/webmin/mysql/backup.pl --all 0 3 * * * /home/flora/public_scripts/backup.sh