How to use unison to sychronize web files in Linux Server

I use the following two programs to auto-backup my server files and database:
web folder backup program: unision
mysql data backup program: mysqldumper

Use unison to copy web folder to another server

A Good instruction:
http://www.howtoforge.com/setting-up-unison-file-synchronization-between...

A simple guideline:

1
install ssh and unison in both server

2
Creating A Private/Public Key Pair On server1

ssh-keygen -t dsa

Note: Do not enter anything for passphrase, just hit the Enter key to use empty

3
copy our public key to remote Server1

copy the contents of Server1 "/root/.ssh/id_dsa.pub" to remote Server2 /root/.ssh/authorized_keys

log in from server1 to server2
ssh root@server1

4
Now check on server2 if server1's public key has correctly been transferred:

cat $HOME/.ssh/authorized_keys

5
to verify that the local unison client can start and connect to the remote server:
From Server1 terminal

unison -testServer /home/www ssh://server2//home/www

6
Running Unison at server1

unison /home/www ssh://server2//home/www

7 make it run automatically

create a preferences file (/root/.unison/default.prf)

nano /root/.unison/default.prf

Sampe Unison default.prf file:

# Unison preferences file
# Roots of the synchronization
root = /home//www
root = ssh://server2.net//home/www

# Some regexps specifying names and paths to ignore
#ignore = Path stats    ## ignores /var/www/stats
#ignore = Path stats/*  ## ignores /var/www/stats/*
#ignore = Path */stats  ## ignores /var/www/somedir/stats, but not /var/www/a/b/c/stats
#ignore = Name *stats   ## ignores all files/directories that end with "stats"
#ignore = Name stats*   ## ignores all files/directories that begin with "stats"
#ignore = Name *.tmp    ## ignores all files with the extension .tmp


#          When set to true, this flag causes the user interface to skip
#          asking for confirmations on non-conflicting changes. (More
#          precisely, when the user interface is done setting the
#          propagation direction for one entry and is about to move to the
#          next, it will skip over all non-conflicting entries and go
#          directly to the next conflict.)
auto=true

#          When this is set to true, the user interface will ask no
#          questions at all. Non-conflicting changes will be propagated;
#          conflicts will be skipped.
batch=true

#          !When this is set to true, Unison will request an extra
#          confirmation if it appears that the entire replica has been
#          deleted, before propagating the change. If the batch flag is
#          also set, synchronization will be aborted. When the path
#          preference is used, the same confirmation will be requested for
#          top-level paths. (At the moment, this flag only affects the
#          text user interface.) See also the mountpoint preference.
confirmbigdel=true

#          When this preference is set to true, Unison will use the
#          modification time and length of a file as a `pseudo inode
#          number' when scanning replicas for updates, instead of reading
#          the full contents of every file. Under Windows, this may cause
#          Unison to miss propagating an update if the modification time
#          and length of the file are both unchanged by the update.
#          However, Unison will never overwrite such an update with a
#          change from the other replica, since it always does a safe
#          check for updates just before propagating a change. Thus, it is
#          reasonable to use this switch under Windows most of the time
#          and occasionally run Unison once with fastcheck set to false,
#          if you are worried that Unison may have overlooked an update.
#          The default value of the preference is auto, which causes
#          Unison to use fast checking on Unix replicas (where it is safe)
#          and slow checking on Windows replicas. For backward
#          compatibility, yes, no, and default can be used in place of
#          true, false, and auto. See the section "Fast Checking" for more
#          information.
fastcheck=true

#          When this preference is set to true, the textual user interface
#          will print nothing at all, except in the case of errors.
#          Setting silent to true automatically sets the batch preference
#          to true.
silent=true

#          When this flag is set to true, file modification times (but not
#          directory modtimes) are propagated.
times=true

8
Edit the crontab file to make the sychronization process automatically:

crontab -e

Make the unison to run every day at 1 AM automatically, if I use /root/.unison/default.prf:
00 01 * * * unison

Crontab help ----------
http://www.thegeekstuff.com/2009/06/15-practical-crontab-examples/

You may need to install NTP and set up time zone for running crontab at the desired time:
Install Network Time NTP

apt-get install ntp

Configure Timezone

sudo dpkg-reconfigure tzdata

MySQL Database backup program:

mysqldumper

http://www.mysqldumper.net/
Powerful, easy to use. The best backup program.

How to use mysqldumper to auto backup mysql database, please see here:
http://thanhsiang.org/faqing/node/193

phpmybackuppro

If your server does not support perl, try this small program. The document is very difficult to understand.
http://www.phpmybackuppro.net/
Small program can configure as auto-backup mysql database (still I don't know it works or not).

Good guide, but one error

i am getting this error under Centos 6.5 x64

Fatal error: File "default", line 49: `confirmbigdel' is not a valid option

when trying to run Unison.

I have confirmbigdel=false

Any thoughts?

azsas

It is only form you that I came to learn on how to sychronize web files in Linux Server and I wish to thank you for providing a detailed tutorial on the same. Kindly do update more of this type of