Hallo Anantha

Rsync : backup your data

August 18, 2007 · No Comments

rsync use for synchronizing file trees. like in the man pages, rsync can be used :

  1. for copying local files. This is invoked when neither source nor destination path contains a : separator
  2. for copying from the local machine to a remote machine using a remote shell program as the transport (such as rsh or ssh). This is invoked when the destination path contains a single : separator.
  3. for copying from a remote machine to the local machine using a remote shell program. This is invoked when the source contains a : separator.
  4. for copying from a remote rsync server to the local machine. This is invoked when the source path contains a :: separator or a rsync:// URL.
  5. for copying from the local machine to a remote rsync server. This is invoked when the destination path contains a :: separator.
  6. for listing files on a remote machine. This is done the same way as rsync transfers except that you leave off the local destination.

By now, i want to back up my data to another server.

so i use it. first, i install rsync

cd /usr/ports/net/rsync

make install clean

edit /usr/local/etc/rsyncd.conf

uid             = userid
gid             = groupid

use chroot      = no

max connections = 4

syslog facility = local5

pid file        = /var/run/rsyncd.pid
[www]        path    = /usr/local/www/

comment = all of the websites

then edit permission rsyncd.conf to 640

after that start the daemon

rsyncd --daemon

that’s all for the server.

in the client install the rsync, but don’t start the daemon.

after that get the module www that refer to /usr/local/www of first server. the example command shell:

rsync -avz --delete xxx.xxx.xxx.xxx::www /backup/data1

that’s mean, i get data /usr/local/www from first server and transfer they to /backup/data1 to second server and delete files or folders that didn’t match again if we do the same command.

we use rsync to get the update data regularly. then we put the script into the /etc/crontab. for example :

7 * * * * root /root/script/rsync.sh 2>&1 | mail -s "rsync script" root

where the rsync.sh was :

#!/bin/sh
/usr/local/bin/rsync -avz –delete xxx.xxx.xxx.xxx::www /backup/data1

-nanta-

Categories: Oprekan

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

Leave a Comment