Showing posts with label Configuration. Show all posts
Showing posts with label Configuration. Show all posts

Thursday, September 18, 2008

Rsync install and configure

Firstly, download rsync and make install, then:
Rsync Server configure file example:


motd file = /etc/rsyncd.motd
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock 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.scrt
test:testYu@Gmail.com
$> chmod 400 /etc/rsyncd.scrt

==================
Client:

$> vi /home/users/passwordfile
testYu@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:

#!/bin/sh
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:$DESTDIR
else
echo "Cannot connect to $DEST."
fi