2013-06-18 10:56:16 +00:00
osync
=====
2013-11-02 20:57:15 +00:00
A two way sync script with fault tolerance, resuming and delete / conflict backups.
2013-06-18 11:02:41 +00:00
## About
2013-11-02 20:57:15 +00:00
I searched for a nice tool to handle two (or more) way sync scenarios in a reliable way, easy to use and automate.
While unison handles these scenarios, it's pretty messy to configure, slow, won't handle ACLs and won't automatically resume if something bad happened.
2013-07-24 19:13:15 +00:00
2013-08-04 08:20:08 +00:00
Then i read about bitpocket, a nice script provided by Marcin Kulik (sickill) at https://github.com/sickill/bitpocket.git
2013-07-24 19:03:58 +00:00
Bitpocked inspired me to write my own implementation of a two way sync script, implementing features i wanted among:
2013-07-24 19:13:15 +00:00
2013-11-02 20:57:15 +00:00
- Fault tolerance with resume scenarios
- Email alerts
2013-07-24 19:13:15 +00:00
- Logging facility
- Soft deletition and multiple backups handling
2013-08-04 08:20:08 +00:00
- Before / after command execution
- Time control
2013-07-24 19:03:58 +00:00
2013-11-02 20:57:15 +00:00
Osync uses a master / slave sync schema. It can sync local and local or local and remote directories. By definition, master replica should always be a local directory on the system osync runs on.
2013-07-24 19:03:58 +00:00
Also, osync uses pidlocks to prevent multiple concurrent sync processes on/to the same master / slave replica. Be sure a sync process is finished before launching next one.
You may launch concurrent sync processes on the same system but only for different master replicas.
2013-06-18 11:02:41 +00:00
2013-11-02 20:57:15 +00:00
Currently, it has been tested on CentOS 5, CentOS 6, Debian 6.0.7, Linux Mint 14, Ubuntu 12.
Osync also runs on FreeBSD and Windows MSYS environment, altough it is not fully tested yet.
2013-08-24 20:12:25 +00:00
2013-06-18 11:02:41 +00:00
## Installation
2013-07-24 19:03:58 +00:00
Keep in mind that Osync has been designed to not delete any data, but rather make backups or soft deletes.
2013-11-02 20:57:15 +00:00
Nevertheless, still consider making backups of your data before trying a sync tool.
2013-07-24 19:03:58 +00:00
First, grab a fresh copy of osync and make it executable:
2013-07-24 19:13:15 +00:00
2013-07-24 19:03:58 +00:00
$ git clone https://github.com/deajan/osync
2013-11-08 11:00:38 +00:00
$ cd osync
2013-07-24 19:03:58 +00:00
$ chmod +x ./osync.sh
2013-11-02 20:57:15 +00:00
Osync needs to run with bash shell. Using any other shell will most probably result in lots of errors.
2013-07-24 19:03:58 +00:00
## Usage
2013-11-03 19:29:17 +00:00
Osync can work with in two flavors: Quick sync mode and configuration file mode.
While quick sync mode is convenient to do fast sync sceanrios, a configuration file gives much more functionnality.
QuickSync example:
$ ./osync.sh --master=/path/to/dir1 --slave=/path/to/dir2
Configuration files example:
You'll have to customize the sync.conf file according to your needs.
Osync needs a pair of private / public RSA keys to perform remote SSH connections.
Also, running sync as superuser requires to configure /etc/sudoers file.
Please read the documentation on author's site.
2013-11-02 20:57:15 +00:00
Once you've customized a sync.conf file, you may run osync with the following test run:
2013-07-24 19:03:58 +00:00
$ ./osync.sh /path/to/your.conf --dry
If everything went well, you may run the actual configuration with one of the following:
$ ./osync.sh /path/to/your.conf
$ ./osync.sh /path/to/your.conf --verbose
2013-08-04 08:20:08 +00:00
$ ./osync.sh /path/to/your.conf --no-maxtime
2013-07-24 19:03:58 +00:00
Verbose option will display which files and attrs are actually synchronized.
2013-08-04 08:20:08 +00:00
No-Maxtime option will disable execution time checks, which is usefull for big initial sync tasks that might take long time. Next runs should then only propagate changes and take much less time.
2013-07-24 19:03:58 +00:00
Once you're confident about your fist runs, you may add osync as cron task with:
$ ./osync.sh /path/to/your.conf --silent
2013-11-02 20:57:15 +00:00
You may then find osync output in /var/log/osync-*.log (or current directory if /var/log is not writable).
2013-06-18 11:02:41 +00:00
## Author
2013-07-24 19:03:58 +00:00
Feel free to mail me for limited support in my free time :)
Orsiris "Ozy" de Jong | ozy@netpower.fr