日期:2014-05-16 浏览次数:20716 次
rpm -qa|grep –i rsync
yum install rsync xinetd
cd rsync-3.0.9 ./configure make && make install
vi /etc/rsyncd.conf #主要全局参数 uid = root gid = root use chroot = yes #为了安全考虑,让rsync运行于chroot环境 log file = /var/log/rsyncd.log #rsync的日志文件 pid file = /var/run/rsyncd.pid #rsync的pid文件 hosts deny = * #除了允许的之外,默认禁止访问 [picData] comment = backup for picServer path = /home/Gzh/rsyncBak read only = no auth users = Gzh secrets file = /etc/rsync.pass hosts allow = 192.168.190.199,127.0.0.1 :wq!
vi /etc/rsync.pass Gzh:123456
chmod 600 /etc/rsync.pass chmod 600 /etc/rsyncd.conf
vi /etc/sysconfig/iptables -A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT :wq
vi /home/Gzh/shell/rsync.pass 123456 :wq
#!/bin/sh #command rsync=/usr/bin/rsync echo=/bin/echo #backup server info remote_host=Gzh@192.168.190.208 remote_path=picData #backup backup_path="/home/Gzh/shell" #passFile passfile_path="/home/Gzh/shell/rsync.pass" for path in $backup_path; do date=`date "+%D %H:%M:%S"` $echo "--- Start Backup $path $date ----" $echo "$rsync -vzrtopg --password-file=$passfile_path $path $remote_host::$remote_path" $rsync -zrtopg --password-file=$passfile_path $path $remote_host::$remote_path date=`date "+%D %H:%M:%S"` $echo "--- End Backup $path $date ----" done