rsync server configure
motd file = /etc/rsyncd.motdlog file = /var/log/rsyncd.logpid file = /var/run/rsyncd.pidlock file = /var/run/rsync.lock[MODULENAME] path = /data/backfrom comment = back data using rsync server uid = nobody gid = nobody read only = no list = yes auth users = test secrets file = /etc/rsyncd.scrt |
rsync --daemon --port=873 vi /etc/rsyncd.scrttest:test@gmail.com chmod 400 /etc/rsyncd.scrt |
client
vi /home/users/passwordfiletest@gmail.com chmod 400 /etc/rsyncd.scrt rsync -vzrtopg --progress --delete test@192.168.0.1::MODULENAME /data/backto --password-file=/home/users/passwordfile |
or connect rsync server using ssh
DEST="192.168.0.1"USER="test"BACKDIR="/data/backfrom/"DESTDIR="/data/backto/"OPTS="-vzrtopg --rsh=ssh --stats --progress"VAR=`ping -s 1 -c 1 $DEST > /dev/null; echo $?`if [ $VAR -eq 0 ]; then rsync $OPTS $BACKDIR $USER@$DEST:$DESTDIRelse echo "Cannot connect to $DEST."fi |