diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..7f816dd --- /dev/null +++ b/LICENSE @@ -0,0 +1,25 @@ +Copyright (c) 2007-2008 Benedikt Böhm +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + +1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. +2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. +3. The name of the author may not be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/README b/README new file mode 100644 index 0000000..ee66cac --- /dev/null +++ b/README @@ -0,0 +1,120 @@ +======= +inosync +======= + +:Author: `Benedikt Böhm `_ +:Version: 0.2 +:Web: http://bb.xnull.de/projects/inosync/ +:Source: http://git.xnull.de/gitweb/?p=inosync.git +:Download: http://bb.xnull.de/projects/inosync/dist/ + +Rationale +========= + +System administrators have relied on cron+rsync for years to constantly +synchronize files and directories to remote machines. However, this technique +has a huge disadvantage for content distribution with near real-time +requirements, e.g. podcasts and blogging. + +It is not feasible to let authors wait for their content to get synchronized +every x hours with regard to the enormous pace of articles and +podcasts nowadays. + +The inosync daemon leverages the inotify service available in recent linux +kernels to monitor and synchronize changes within directories to remote nodes. + + +Usage +===== + +:: + + inosync [OPTIONS] + + -c FILE load configuration from FILE + -d daemonize (fork to background) + -p do not actually call rsync + -v print debugging information + --version show program's version number and exit + -h, --help show this help message and exit + + +Configuration +============= + +Configuration files are simple python scripts, merely declaring necessary +variables. Below is an example configuration to synchronize ``/var/www`` +except ``/var/www/localhost`` to 3 remote locations: +:: + + # directory that should be watched for changes + wpath = "/var/www/" + + # exclude list for rsync + rexcludes = [ + "/localhost", + ] + + # common remote path + rpath = "/var/www/" + + # remote locations in rsync syntax + rnodes = [ + "a.mirror.com:" + rpath, + "b.mirror.com:" + rpath, + "c.mirror.com:" + rpath, + ] + + # limit remote sync speed (in KB/s, 0 = no limit) + #rspeed = 0 + + # event mask (only sync on these events) + #emask = [ + # "IN_CLOSE_WRITE", + # "IN_CREATE", + # "IN_DELETE", + # "IN_MOVED_FROM", + # "IN_MOVED_TO", + #] + + # event delay in seconds (this prevents huge + # amounts of syncs, but dicreases the + # realtime side of things) + #edelay = 10 + + # rsync binary path + #rsync = "/usr/bin/rsync" + + +Bugs +==== + +There are no known bugs currently, however, due to the design of inosync, there +are several shortcomings: + +- inosync cannot parse rsync excludes and therefore calls rsync on changes in + excluded directories as well. (`of course rsync still excludes these + directories`) +- It is easily possible to flood the daemon with huge amounts of change events, + potentially resulting in enormous bandwidth and connection usage. + +Requirements +============ + +To use this script you need the following software installed on your system: + +- linux-2.6.13 or later +- Python-2.4 or later +- pyinotify-0.7.0 or later + + +Related Software +================ + +inosync is similar to `lsyncd `_, +but uses a lot less (nasty) magic to parse rsync excludes and shared www +directories. Additionally inosync has no limitation on filename size and number +of active watchpoints. + +A comparision to other approaches like DRBD, incron and FUSE can be found at +lsyncds project page, mentioned above. diff --git a/inosync.py b/inosync.py index cd288c3..5f0e1cd 100755 --- a/inosync.py +++ b/inosync.py @@ -1,40 +1,5 @@ #!/usr/bin/python # vim: set fileencoding=utf-8 ts=2 sw=2 expandtab : -# -# Copyright (c) 2007-2008 Benedikt Böhm -# All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions -# are met: -# -# 1. Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# 2. Redistributions in binary form must reproduce the above copyright -# notice, this list of conditions and the following disclaimer in the -# documentation and/or other materials provided with the distribution. -# 3. The name of the author may not be used to endorse or promote products -# derived from this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR -# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES -# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. -# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, -# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT -# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF -# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -# -# ChangeLog: -# -# *inosync-0.2 (24 Jan 2008): -# use configuration files -# add event delay option -# -# *inosync-0.1 (09 Jan 2008): -# initial version import os,sys from optparse import OptionParser,make_option @@ -43,7 +8,7 @@ from pyinotify import * __author__ = "Benedikt Böhm" -__copyright__ = "Copyright (c) 2007-2008 Benedikt Böhm " +__copyright__ = "Copyright (c) 2007-2008 Benedikt Böhm " __version__ = 0,2 OPTION_LIST = [ diff --git a/mkrelease.sh b/mkrelease.sh new file mode 100755 index 0000000..a1dcafe --- /dev/null +++ b/mkrelease.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +source /etc/init.d/functions.sh + +PROJECT=inosync +VERSION=$(sed 's/^:Version: \(.*\)/\1/;t;d' README) + +mkdir -p ~/public_html/projects/${PROJECT}/dist + +ebegin "Creating release tarball" +git-archive --format=tar --prefix=${PROJECT}-${VERSION}/ HEAD | \ +bzip2 > ~/public_html/projects/${PROJECT}/dist/${PROJECT}-${VERSION}.tar.bz2 +eend $? + +ebegin "Generating project page" +rst2html.py < README > ~/public_html/projects/${PROJECT}/index.html +eend $?