and moved the lsyncd2 development branch to be main trunk now.

This commit is contained in:
Axel Kittenberger 2010-11-16 21:14:30 +00:00
commit aa6bc7326e
35 changed files with 4573 additions and 15053 deletions

View File

@ -1,5 +0,0 @@
Axel Kittenberger <axel.kittenberger@univie.ac.at>
Semi Malinen <treamur@kesto.net>
Jürgen "README" Mangler <juergen.mangler@univie.ac.at>
Eugene Sanivsky <eugenesan@gmail.com>
Junichi Uekawa <dancerj@gmail.com>

340
COPYING
View File

@ -1,340 +0,0 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) <year> <name of author>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.

View File

@ -1,54 +0,0 @@
04-10-2010: 1.39
enhancement: call action for multiple targets simultanously
fix: correctly accept <file-filter/> from config xml
fix: correctly close and free the inotify file descriptor in case of restart
due to HUP signal or OVERFLOW condition
fix: when delay=0 a bug always called rsync file filter even when in
directory mode
01-09-2010: 1.38
enhancement: implemented file filters for singular operations
enhancement: added --singular parameter for single file calls
fix: fixed --dryrun messages
improvement: now restarts on an inotify OVERFLOW message, just like if
being kill -HUPed
internal: printout the actual binary called when --debug specified
05-08-2010: 1.37
enhancement: react on HUP signals (interpreted as complete restart)
enhancement: inotifies are configureable
enhancement: --no-startup skips the startup calls
fix : fixed delayed blocking handling.
improvement: made logging output better readable
internal: made all global variables local
internal: renamed "tackles" to "delays"
internal: removed the need of the "tosync" stack
internal: use more pointers instead of indexes
11-07-2010: 1.34
fix: logging segfault on 64bit systems
changed: man page location, spellings
05-06-2010: 1.33
fix: exlude file argument passing to rsync
fix: allow exlude files specified for individual sources
fix/enhancement: exlusions will be compared with extended
path files allowing sub dirs to be excluded.
enhancement: allow delays and call aggregation
05-01-2009: Release of lsyncd 1.26
fix: segfault on multitargets
changed meaning of "version" tag in lsyncd.conf.xml
14-12-2008: Release of lsyncd 1.25
fix: mv dir and cp -r working
fix: working with reiserfs
enhancement: config files
enhancement: multiple targets
enhancement: pidfiles
optimized: memory usage
improved documentation
lots of smaller stuff here and there ...
Thanks to all contributers!
05-12-2007: Release of lsyncd 1.0

182
INSTALL
View File

@ -1,182 +0,0 @@
Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes awhile. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Optionally, type `make check' to run any self-tests that come with
the package.
4. Type `make install' to install the programs and any data files and
documentation.
5. You can remove the program binaries and object files from the
source code directory by typing `make clean'. To also remove the
files that `configure' created (so you can compile the package for
a different kind of computer), type `make distclean'. There is
also a `make maintainer-clean' target, but that is intended mainly
for the package's developers. If you use it, you may have to get
all sorts of other programs in order to regenerate files that came
with the distribution.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
In addition, if you use an unusual directory layout you can give
options like `--bindir=PATH' to specify different values for particular
kinds of files. Run `configure --help' for a list of the directories
you can set and what kinds of files go in them.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made. To
suppress all normal output, redirect it to `/dev/null' (any error
messages will still be shown).
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.

View File

@ -1,44 +1,34 @@
## Makefile.am -- Process this file with automake to produce Makefile.in
AUTOMAKE_OPTIONS = foreign
CFLAGS = -Wall $(LIBLUA_CFLAGS)
bin_PROGRAMS = lsyncd
lsyncd_SOURCES = lsyncd.c
TESTS = tests/help.sh \
tests/directorycpr.sh \
tests/directorycpr0.sh \
tests/directorymv.sh \
tests/pidfile.sh \
tests/version.sh \
tests/wrong-logfile.sh \
tests/wrong-rsync.sh
lsyncd_SOURCES = lsyncd.c lsyncd.lua
lsyncd_LDADD = $(LIBLUA_LIBS)
exampledir = $(datarootdir)/doc/@PACKAGE@
dist_example_DATA = \
examples/lbash.lua \
examples/limagemagic.lua \
examples/lrsync.lua \
examples/lrsyncssh.lua
datarootdir = @datarootdir@
if RUNNER
EXTRA_DIST = config.h.in inotify-nosys.h lsyncd.conf.xml \
doc/manpage.lsyncd.xml doc/manpage.lsyncd.conf.xml \
doc/lsyncd.1 doc/lsyncd.conf.xml.5
# installs the runner
runnerdir = $(RUNNER_DIR)
runner_DATA = lsyncd.lua
nodist_man1_MANS = doc/lsyncd.1
nodist_man5_MANS = doc/lsyncd.conf.xml.5
else
check-syntax:
$(CC) -c -O2 -Wall $(CHK_SOURCES) -o/dev/null
# or compiles it into the binary
lsyncd: luac.o $(lsyncd_LDADD)
DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP = xsltproc -''-nonet \
-''-param man.charmap.use.subset "0" \
-''-param make.year.ranges "1" \
-''-param make.single.year.ranges "1"
architecture: | lsyncd.o
objdump -f $< | grep architecture | sed -e "s/,.*$$//" -e "s/[^ ]* \(.*\)/\1/" > $@ || rm architecture
doc/lsyncd.1: doc/manpage.lsyncd.xml
$(XP) -o $@ $(DB2MAN) $<
luac.o: luac.out architecture
objcopy --input-target=binary --output-target=`gcc -dumpmachine` --binary-architecture=`cat architecture` $< $@
doc/lsyncd.conf.xml.5: doc/manpage.lsyncd.conf.xml
$(XP) -o $@ $(DB2MAN) $<
luac.out: lsyncd.lua
luac $<
AM_CFLAGS=-Wall
AM_LDFLAGS=
if XML_CONFIG
DEFS+=-DXML_CONFIG
AM_CFLAGS += `xml2-config --cflags`
AM_LDFLAGS += `xml2-config --libs`
endif

2
NEWS
View File

@ -1,2 +0,0 @@
2010-06-05: Finally calls to rsync are aggregated.
2007-12-05: Lsyncd has been created. Hurray!

122
README
View File

@ -1,122 +0,0 @@
lsyncd - Live Syncing (Mirror) Daemon
DESCRIPTION:
Lsyncd uses rsync to synchronize local directories with a remote machine
running rsyncd. Lsyncd watches multiple directories trees through inotify.
The first step after adding the watches is to, rsync all directories with
the remote host, and then sync single file buy collecting the inotify events.
So lsyncd is a light-weight live mirror solution that should be easy to
install and use while blending well with your system.
See lsyncd --help for detailed command line options.
WHEN TO USE:
Lsyncd is designed to synchronize a local directory tree with low profile of
expected changes to a remote mirror. On the receivers side rsyncd can be
configured to also change the uid/gid of the file. Lsyncd is especially
useful to sync data from a secure area to a not-so-secure area (e.g. as a
one way connection to allow employees to publish their files to a public
accessible web server).
WHEN NOT TO USE:
* File with active file handles (e.g. database files)
* Directories where many changes occur (like mail or news servers)
In these cases e.g. DRBD (see http://www.drbd.org/) might be better
for you.
COMPARISONS:
Lsyncd vs. DRBD:
DRBD operates on block device level. This makes it useful for
synchronizing systems that are under heavy load. Lsyncd on the other hand
* does not require you to change block devices and/or mount points.
* allows you to change uid/gid of the transferred files.
* separates the receiver through the one-way nature of rsync.
However when using lsyncd a file change can possibly result in a full file
transfer (at least for binary files) and is therefore unsuitable for
databases. Also a directory rename will result in transferring the whole
directory.
Lsyncd vs. incron:
Incron does not (yet) support recursive directory watching making it
unsuitable for described needs (http://inotify.aiken.cz/?section=incron&page=about&lang=en).
In fact a different approach would have been to extent incron. However, we
decided to stick to the NIH principle (Not Invented Here) :-), because extending
the C++ solution seemed to tedious.
Lsyncd vs. FUSE:
This is another interesting idea is to write a daemon that provides a
shadow file system through fuse. When accessing a file the data is synced
to local file as well as the remote file. Whit this approach inotify could
be replaced. GlusterFS does exactly this and more (see http://www.gluster.org).
BindFS (see http://www.cs.helsinki.fi/u/partel/bindfs/) does this for local
mirroring. We discarded this idea because it would affect performance of
normal operations in a negative way.
Lsyncd vs. cron:
If you find a solution using cron to call rsync over the whole directory
tree periodically after every 'X' hours/minutes/seconds more satisfying
than lsyncd, please go for it *sulking*. We don't like it!
LSYNCD USAGE EXAMPLES:
/usr/sbin/lsyncd /var/www/ remotehost::wwwshare/
This watches and rsycn's the local directory /var/www/ with all
subdirectories and transfers them to 'remotehost' using the rsync-share
'wwwshare'.
/usr/sbin/lsyncd --nodaemon --exclude-from /etc/lsycnd/exclude \
/var/www/ remotehost::wwwshare/
This will also rsync/watch '/var/www', but it excludes files and directories
from '/etc/lsycnd/exclude'. Additionally this example lsyncd will not fork,
and log to stdout/stderr instead.
/usr/sbin/lsyncd %userwww remotehost::wwwshare/foobar/
This special target will scan through all directories in /home and syncs all
www subdirectories of the users to wwwshare in the subdirectory foobar.
The user peter having his local data in /home/peter/www/ will have it
rsynced to ::wwwshare/foobar/peter/.
LIMITATIONS:
Be aware that the kernel limits the number of watches. You can see the limit
in
/proc/sys/fs/inotify/max_user_watches
which is usually set to 8192. This means lsyncd cannot watch more than 8192
directories unless you change the kernel setting. Lsyncd itself has no
limits.
Because Axel is lazy the maximum possible size a filename is 8192. If you
need more, change MAX_PATH in lsyncd.c. Or send me patches that introduce
dynamic memory usage.
SOURCE DOCUMENTATION:
The only file of interest is 'lsyncd.c' which includes comments.
Everything else in the tarball is packaging bushwa.
DISCLAIMER:
Besides the usual disclaimer in the license, we want to specifically EMPHASIZE
that NEITHER the authors NOR any organization the authors are associated with
can and will hold responsible for data-loss caused by possible malfunctions
of lsyncd. Especially if you run it with root privileges ;-) (we ourselves
run lsyncd as www-data).
FEEDBACK:
Please send praises and feedback to: axel.kittenberger@univie.ac.at

9
TODO
View File

@ -1,9 +0,0 @@
* React on signal HUP resync and rewatch everything.
* Workaround the kernel watches limit by opening another inotify
instance when needed.
* React on inotify OVERFLOW messages in resyncing everything, something might
have been missed.
* Allow more complicated exclusion masks.
* Do not call rsync at all if a file was edited that falls under the exclusion
mask (currently it is called, and rsync drops it).
* improve config.h.in generation

View File

@ -1,11 +1,9 @@
#!/bin/bash
# simplistic script to run after checkout
#!/bin/sh
# In case of explicit having a 1.7 version use that (for systems having multiple automake versions installed)
ACLOCAL=`which aclocal-1.7 || echo aclocal`
AUTOMAKE=`which automake-1.7 || echo automake`
echo "Generating configure files... may take a while."
$ACLOCAL && \
autoheader && \
autoconf && \
$AUTOMAKE -a -c
autoreconf --install --force && \
echo "Preparing was successful if there was no error messages above." && \
echo "Now type:" && \
echo " ./configure && make" && \
echo "Run './configure --help' for more information"

1500
config.guess vendored

File diff suppressed because it is too large Load Diff

1608
config.sub vendored

File diff suppressed because it is too large Load Diff

29
configure.ac Normal file
View File

@ -0,0 +1,29 @@
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
#AC_PREREQ(2.60)
AC_INIT(lsyncd, 2.0beta1, axkibe@gmail.com)
AC_CONFIG_SRCDIR([lsyncd.c],[lsyncd.lua])
AC_CONFIG_HEADER([config.h])
AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
# Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
# Checks for libraries.
PKG_CHECK_MODULES(LIBLUA, lua5.1)
# Checks for header files.
AC_CHECK_HEADERS([sys/inotify.h])
AC_ARG_WITH([runner],
[ --with-runner=<dir> Specify directory where lsyncds part written in Lua will be placed.
If missing it will be compiled into the binary)])
if test "x${with_runner}" != x; then
AC_DEFINE_UNQUOTED(LSYNCD_DEFAULT_RUNNER_FILE, "${with_runner}/lsyncd.lua", "descr")
AC_SUBST(RUNNER_DIR, "${with_runner}")
fi
AM_CONDITIONAL([RUNNER], [test x${with_runner} != x])
# Checks for typedefs, structures, and compiler characteristics.
# Checks for library functions.
AC_CONFIG_FILES([Makefile])
AC_OUTPUT

View File

@ -1,28 +0,0 @@
AC_INIT(lsyncd.c)
m4_define(LSYNCD_PACKAGE,lsyncd)
m4_define(LSYNCD_VERSION,1.39)
AM_INIT_AUTOMAKE(LSYNCD_PACKAGE,LSYNCD_VERSION)
AC_ARG_ENABLE([xml_config],
[ --enable-xml-config Lsyncd is able to parse lsyncd.conf files (default: enabled)],
[case "${enableval}" in
yes) xml_config=true ;;
no) xml_config=false ;;
*) AC_MSG_ERROR([bad value ${enableval} for --enable-xml-config]) ;;
esac],[xml_config=true])
AM_CONDITIONAL(XML_CONFIG,[test x$xml_config = xtrue])
#if test x$xml_config = xtrue; then
#AM_PATH_XML2(2.5.0,,AC_MSG_ERROR([*** Libxml is required if you do not --disable-xml-config]))
#fi
AM_MAINTAINER_MODE
AC_PROG_CC
AC_PROG_INSTALL
AC_CHECK_HEADERS([sys/inotify.h])
AC_CONFIG_HEADERS([config.h])
AC_OUTPUT(Makefile)

View File

@ -1,171 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!--
`xsltproc -''-nonet \
-''-param man.charmap.use.subset "0" \
-''-param make.year.ranges "1" \
-''-param make.single.year.ranges "1" \
/usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl \
manpage.xml'
A manual page <package>.<section> will be generated. You may view the
manual page with: nroff -man <package>.<section> | less'. A typical entry
in a Makefile or Makefile.am is:
DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0"
manpage.1: manpage.xml
$(XP) $(DB2MAN) $<
The xsltproc binary is found in the xsltproc package. The XSL files are in
docbook-xsl. A description of the parameters you can use can be found in the
docbook-xsl-doc-* packages. Please remember that if you create the nroff
version in one of the debian/rules file targets (such as build), you will need
to include xsltproc and docbook-xsl in your Build-Depends control field.
Alternatively use the xmlto command/package. That will also automatically
pull in xsltproc and docbook-xsl.
Notes for using docbook2x: docbook2x-man does not automatically create the
AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as
<refsect1> ... </refsect1>.
To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections
read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be
found in the docbook-xsl-doc-html package.
Validation can be done using: `xmllint -''-noout -''-valid manpage.xml`
General documentation about man-pages and man-page-formatting:
man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
-->
]>
<refentry>
<refentryinfo>
<title>lsyncd User Manual</title>
<productname>lsyncd</productname>
<authorgroup>
<author>
<firstname>Axel</firstname>
<surname>Kittenberger</surname>
<address>
<email>axel.kittenberger@univie.ac.at</email>
</address>
</author>
</authorgroup>
<legalnotice>
<para>Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU General Public License,
Version 2 or (at your option) any later version published by
the Free Software Foundation.</para>
</legalnotice>
</refentryinfo>
<refmeta>
<refentrytitle>LSYNCD.CONF.XML</refentrytitle>
<manvolnum>5</manvolnum>
</refmeta>
<refnamediv>
<refname>lsyncd.conf.xml</refname>
<refpurpose>xconfig file for <command>lsyncd</command></refpurpose>
</refnamediv>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para><filename>lsyncd.conf.xml</filename> is used to configure the <command>lsyncd</command> daemon. </para>
<para>Note that any command line options can overrule settings in the config file. A <command>lsyncd</command> configuration file has an XML grammar. That means tags have to be closed with a / and the such. Following explanations will be provided with an examples. </para>
<para>The config file must start with a <option>&lt;lsyncd&gt;</option> root node. A &quot;version&quot; parameter has to be present which specifies the lsyncd version of the config file format. Currently this is 1.</para>
<programlisting>&lt;lsyncd version=&quot;1&quot;&gt;</programlisting>
<refsect2 id="settings">
<title>SETTINGS</title>
<para>Next is optionally a <option>&lt;settings&gt;</option> node. It controls lsyncd global settings. All settings are optional.</para>
<programlisting> &lt;settings&gt;</programlisting>
<para>If a <option>&lt;debug/&gt;</option> node is present all debug messages will be logged. Default is a normal verbosity.</para>
<programlisting> &lt;debug/&gt;</programlisting>
<para>If <option>&lt;delay/&gt;</option> specified by the "value" parameter is greater than zero, lsyncd waits this amount of seconds between an event and calling the binary. All events for a directory in this timeframe will be aggregated to one call. If delay is 0 changes will be handlet immediatly. Default is 5 seconds.</para>
<programlisting> &lt;delay/&gt;</programlisting>
<para>If a <option>&lt;scarce&gt;</option> node is present only error messages will be logged. Default is a normal verbosity.</para>
<programlisting> &lt;scarce/&gt;</programlisting>
<para>If a <option>&lt;stubborn&gt;</option> node is present lsyncd will continue even if the startup sync fails. Default is being not stubborn.</para>
<programlisting> &lt;stubborn/&gt;</programlisting>
<para>If a <option>&lt;no-daemon&gt;</option> node is present lsyncd will not detach and log to stdout/stderr. Default is to detach as daemon.</para>
<programlisting> &lt;no-daemon/&gt;</programlisting>
<para>If a <option>&lt;no-startup&gt;</option> node is present lsyncd will not initiate the recursive rsync call on startup. Not adviced, know what you are doing if using this.</para>
<programlisting> &lt;no-startup/&gt;</programlisting>
<para>If a <option>&lt;dry-run&gt;</option> node is present lsyncd will not call any actions (rsync) for test purposes. Default is not to run dry.</para>
<programlisting> &lt;dry-run/&gt;</programlisting>
<para>With an <option>&lt;exclude-from&gt;</option> entry an exclusion file can be specified with a &quot;filename&quot; parameter. This will be passed to rsync and follows rsyncs grammar for exclude files. Default is not to pass an exlude file to rsync.</para>
<programlisting> &lt;exclude-from filename=&quot;/etc/lsyncd.exclude&quot;/&gt;</programlisting>
<para>With a <option>&lt;logfile&gt;</option> node to location of the logfile can be changed. Default is <filename>/var/log/lsyncd</filename>. Take care that the user which lsyncd is running with can write to this file.</para>
<programlisting> &lt;logfile filename=&quot;/var/log/lsyncd&quot;/&gt;</programlisting>
<para>A <option>&lt;binary&gt;</option> node specifies the binary lsyncd will call to sync stuff. Usually you want this to be rsync. Default is <filename>/usr/bin/rsync</filename>.</para>
<programlisting> &lt;binary filename=&quot;/usr/bin/rsync&quot;/&gt;</programlisting>
<para>If a <option>&lt;pidfile&gt;</option> node is present lsyncd will write its pid there. Default is not to write a pidfile.</para>
<programlisting> &lt;pidfile filename=&quot;/var/run/lsyncd.pid&quot;/&gt;</programlisting>
<para>With a <option>&lt;callopts&gt;</option> node you can control the arguments lsyncd will call the &lt;binary&gt; (rsync) with. Each child node will specify one argument. &lt;option&gt; specifies a literal argument. Only %r will be replaced with 'r' when rsycnd is supposed to work recursive (on startup of lsyncd) or 'd' on normal operations. &lt;exclude-file&gt; will be replaced with <option>--exclude-from [FILE]</option> if an &lt;exclude-from&gt; file is specified. &lt;source&gt; will be replaced the source directory to sync from. &lt;destination&gt; will be replace to the target to sync to. Default arguments are <option>-lts%r --delete {--exclude-from [FILE]} [SOURCE] [DIRECTORY]</option>.</para>
<programlisting> &lt;callopts&gt;
<para>With a <option>&lt;inotify&gt;</option> node you can control the inotify events lsyncd will register to. Each event is configured by a &lt;event&gt; child node and its attribute 'id'. The following events may be registered: ACCESS,ATTRIB,CLOSE_WRITE,CLOSE_NOWRITE,CREATE,DELETE,DELETE_SELF,MODIFY,MOVE_SELF,MOVED_FROM,MOVED_TO,OPEN. If the inotify node is omitted the following events are registered by default: IN_ATTRIB,IN_CLOSE_WRITE,IN_CREATE,IN_DELETE,IN_DELETE_SELF,IN_MOVED_FROM,IN_MOVED_TO,IN_DONT_FOLLOW,IN_ONLYDIR.</para>
<programlisting> &lt;inotify&gt;
&lt;event id="MOVED_TO"/&gt;
&lt;event id="DELETE"/&gt;
&lt;/inotify&gt;</programlisting>
&lt;option text=&quot;-lts%r&quot;/&gt;
&lt;option text=&quot;--delete&quot;/&gt;
&lt;exclude-file/&gt;
&lt;source/&gt;
&lt;destination/&gt;
&lt;/callopts&gt;</programlisting>
<para>End of (optional) settings section.</para>
<programlisting> &lt;/settings&gt;</programlisting>
</refsect2>
<refsect2 id="directory">
<title>DIRECTORIES</title>
+ <para>With <option>&lt;directory&gt;</option> nodes arbitrarily many sources to be watched can be specified. Within a &lt;directory&gt; entry you can again specify a <option>&lt;binary&gt;</option>, <option>&lt;exclude-from&gt;</option>, <option>&lt;callopt&gt;</option> or a <option>&lt;inotify&gt;</option> node which will override global settings just for this source. See SETTINGS for details on this options.</para>
+ <para> The mandatory <option>&lt;source&gt;</option> node specifies with the paramater &quot;path&quot; the directory to watch and sync. (once in a while something is mandatory. Also at least one <option>&lt;target;&gt;</option> node has to specified where to sync to. This has to be a format accepted by rsync.</para>
<programlisting> &lt;directory&gt;
&lt;source path=&quot;/absolute/path/to/source&quot;/&gt;
&lt;target path=&quot;desthost::module/&quot;/&gt;
&lt;/directory&gt;</programlisting>
</refsect2>
<para>End of a <filename>lsyncd.conf.xml</filename> file.</para>
<programlisting>&lt;/lsyncd&gt;</programlisting>
</refsect1>
<refsect1 id="files">
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>/etc/lsyncd.conf.xml</filename></term>
<listitem>
<para>The default location of the configuration file.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="see_also">
<title>SEE ALSO</title>
<!-- In alpabetical order. -->
<para><citerefentry>
<refentrytitle>lsyncd</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry></para>
</refsect1>
</refentry>

View File

@ -1,355 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [
<!--
`xsltproc -''-nonet \
-''-param man.charmap.use.subset "0" \
-''-param make.year.ranges "1" \
-''-param make.single.year.ranges "1" \
/usr/share/xml/docbook/stylesheet/nwalsh/manpages/docbook.xsl \
manpage.xml'
A manual page <package>.<section> will be generated. You may view the
manual page with: nroff -man <package>.<section> | less'. A typical entry
in a Makefile or Makefile.am is:
DB2MAN = /usr/share/sgml/docbook/stylesheet/xsl/nwalsh/manpages/docbook.xsl
XP = xsltproc -''-nonet -''-param man.charmap.use.subset "0"
manpage.1: manpage.xml
$(XP) $(DB2MAN) $<
The xsltproc binary is found in the xsltproc package. The XSL files are in
docbook-xsl. A description of the parameters you can use can be found in the
docbook-xsl-doc-* packages. Please remember that if you create the nroff
version in one of the debian/rules file targets (such as build), you will need
to include xsltproc and docbook-xsl in your Build-Depends control field.
Alternatively use the xmlto command/package. That will also automatically
pull in xsltproc and docbook-xsl.
Notes for using docbook2x: docbook2x-man does not automatically create the
AUTHOR(S) and COPYRIGHT sections. In this case, please add them manually as
<refsect1> ... </refsect1>.
To disable the automatic creation of the AUTHOR(S) and COPYRIGHT sections
read /usr/share/doc/docbook-xsl/doc/manpages/authors.html. This file can be
found in the docbook-xsl-doc-html package.
Validation can be done using: `xmllint -''-noout -''-valid manpage.xml`
General documentation about man-pages and man-page-formatting:
man(1), man(7), http://www.tldp.org/HOWTO/Man-Page/
-->
<!ENTITY dhpackage "lsyncd">
]>
<refentry>
<refentryinfo>
<title>lsyncd User Manual</title>
<productname>lsyncd</productname>
<authorgroup>
<author>
<firstname>Junichi</firstname>
<surname>Uekawa</surname>
<contrib>Wrote this manpage for the Debian system.</contrib>
<address>
<email>dancer@debian.org</email>
</address>
</author>
<author>
<firstname>Axel</firstname>
<surname>Kittenberger</surname>
<contrib>Strives to keep this up to date.</contrib>
<address>
<email>axel.kittenberger@univie.ac.at</email>
</address>
</author>
</authorgroup>
<copyright>
<year>2008</year>
<holder>Junichi Uekawa, Axel Kittenberger</holder>
</copyright>
<legalnotice>
<para>Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU General Public License,
Version 2 or (at your option) any later version published by
the Free Software Foundation.</para>
</legalnotice>
</refentryinfo>
<refmeta>
<refentrytitle>LSYNCD</refentrytitle>
<manvolnum>1</manvolnum>
</refmeta>
<refnamediv>
<refname>&dhpackage;</refname>
<refpurpose>A rsync-based tool to monitor a directory including subdirectories and update modifications.</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>&dhpackage;</command>
<!-- These are several examples, how syntaxes could look -->
<arg choice="opt"><option>--binary <parameter>FILE</parameter></option></arg>
<arg choice="opt"><option>--conf <parameter>FILE</parameter></option></arg>
<arg choice="opt"><option>--debug</option></arg>
<arg choice="opt"><option>--delay <parameter>SECS</parameter></option></arg>
<arg choice="opt"><option>--dryrun</option></arg>
<arg choice="opt"><option>--exclude-file <parameter>FILE</parameter></option></arg>
<arg choice="opt"><option>--logfile <parameter>FILE</parameter></option></arg>
<arg choice="opt"><option>--no-daemon</option></arg>
<arg choice="opt"><option>--pidfile <parameter>FILE</parameter></option></arg>
<arg choice="opt"><option>--scarce</option></arg>
<arg choice="opt"><option>--stubborn</option></arg>
<arg choice="opt"><replaceable>source</replaceable></arg>
<arg choice="opt"><replaceable>target...</replaceable></arg>
</cmdsynopsis>
<cmdsynopsis>
<command>&dhpackage;</command>
<!-- Normally the help and version options make the programs stop
right after outputting the requested information. -->
<group choice="opt">
<arg choice="plain">
<group choice="req">
<arg choice="plain"><option>--help</option></arg>
</group>
</arg>
<arg choice="plain">
<group choice="req">
<arg choice="plain"><option>--version</option></arg>
</group>
</arg>
</group>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para><command>&dhpackage;</command> is a program that uses rsync
to synchronize local directories with a or several remote machine(s)
running rsyncd. Lsyncd watches multiple directory trees through
inotify. On startup it will rsync all directories with the remote
host(s), and then sync single directories by collecting the inotify
events. This tool is a light-weight live mirror solution.
</para>
</refsect1>
<refsect1 id="options">
<title>OPTIONS</title>
<para>The program takes options starting with two dashes (`-'). A summary of
options is included below.</para>
<variablelist>
<!-- Use the variablelist.term.separator and the
variablelist.term.break.after parameters to
control the term elements. -->
<varlistentry>
<term><option>--binary <parameter>FILE</parameter></option></term>
<listitem>
<para>Call this binary to sync (DEFAULT: /usr/bin/rsync).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--conf <parameter>FILE</parameter></option></term>
<listitem>
<para>config file to read config from. See <citerefentry> <refentrytitle>lsyncd.conf.xml</refentrytitle><manvolnum>5</manvolnum></citerefentry></para>
<para>Default: <filename>/etc/lsyncd.conf.xml</filename> if no <option>source</option>, <option>target</option> is given in the commandline. If they are given and <arg>--conf</arg> is not given no config file will be loaded.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--debug</option></term>
<listitem>
<para>Log debug messages</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--deleay <parameter>SECS</parameter></option></term>
<listitem>
<para>If <option>&lt;delay/&gt;</option> is greater than zero, lsyncd waits this amount of seconds between an event and calling the binary. All events for a directory in this timeframe will be aggregated to one call. Default is 5 seconds.</para>
<programlisting> &lt;delay/&gt;</programlisting>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--dryrun</option></term>
<listitem>
<para>Do not call rsync, run dry only</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--exclude-file <parameter>FILE</parameter></option></term>
<listitem>
<para>Exclude file handlet to rsync (DEFAULT: None).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--logfile <parameter>FILE</parameter></option></term>
<listitem>
<para>Put log here (DEFAULT: /var/log/lsyncd).</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-daemon</option></term>
<listitem>
<para>Do not detach, log to stdout/stderr.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--no-startup</option></term>
<listitem>
<para>Skips the inital recursive rsync. This option is not adviced and may lead to failures if the target
is missing directories. Know what you are doing if you use it.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--pidfile <parameter>FILE</parameter></option></term>
<listitem>
<para>Create a file with pid of application.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--scarce</option></term>
<listitem>
<para>Only log errors.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--stubborn</option></term>
<listitem>
<para>Continue even if startup sync fails.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--help</option></term>
<listitem>
<para>Show summary of options.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>--version</option></term>
<listitem>
<para>Show version of program.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="files">
<title>FILES</title>
<variablelist>
<varlistentry>
<term><filename>/etc/lsyncd.conf.xml</filename></term>
<listitem>
<para>The default location of configuration file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><filename>/var/log/lsyncd</filename></term>
<listitem>
<para>The default location of log file. Make sure the
running user has write access to this file, or specify a
different log file name.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="diagnostics">
<title>DIAGNOSTICS</title>
<!-- There are actually now a lot of errors that can be present at
stderr if something is wrong in the config file. Leave this
section for now. -->
<!--para>The following diagnostics may be issued
on <filename class="devicefile">stderr</filename>:</para>
<variablelist>
<varlistentry>
<term><errortext>Out of memory!</errortext></term>
<listitem>
<para>It might get out of memory.
</para>
</listitem>
</varlistentry>
</variablelist-->
<para><command>&dhpackage;</command> provides some return codes, that can
be used in scripts:</para>
<segmentedlist>
<segtitle>Code</segtitle>
<segtitle>Diagnostic</segtitle>
<seglistitem>
<seg><errorcode>0</errorcode></seg>
<seg>Program exited successfully.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>1</errorcode></seg>
<seg>Out of memory.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>2</errorcode></seg>
<seg>File was not found, or failed to write.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>3</errorcode></seg>
<seg>binary (most likely rsync) returned non-zero result on startup.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>4</errorcode></seg>
<seg>Something wrong the command-line arguments in the lsyncd invocation.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>5</errorcode></seg>
<seg>Too many exclude files were specified.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>6</errorcode></seg>
<seg>Something wrong with the config file.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>7</errorcode></seg>
<seg>Kernel cannot do inotify.</seg>
</seglistitem>
<seglistitem>
<seg><errorcode>255</errorcode></seg>
<seg>Internal failure.</seg>
</seglistitem>
</segmentedlist>
</refsect1>
<!--refsect1 id="bugs">
<!- Or use this section to tell about upstream BTS. ->
<title>BUGS</title>
<para>TBD.</para>
</refsect1-->
<refsect1 id="see_also">
<title>SEE ALSO</title>
<!-- In alpabetical order. -->
<para>
<citerefentry>
<refentrytitle>lsyncd.conf.xml</refentrytitle>
<manvolnum>5</manvolnum>
</citerefentry>
<citerefentry>
<refentrytitle>rsync</refentrytitle>
<manvolnum>1</manvolnum>
</citerefentry>
</para>
<para>The programs are documented fully in README file available
in <filename>/usr/share/doc/lsyncd/README.gz</filename>.</para>
</refsect1>
</refentry>

40
examples/lbash.lua Normal file
View File

@ -0,0 +1,40 @@
-----
-- User configuration file for lsyncd.
--
-- This example uses local bash commands to keep two local
-- directory trees in sync.
--
settings = {
logfile = "/tmp/lsyncd.log",
statusFile = "/tmp/lsyncd.stat",
statusIntervall = 1,
nodaemon = true,
}
-----
-- for testing purposes. prefix can be used to slow commands down.
-- prefix = "sleep 5 && "
--
prefix = ""
-----
-- for testing purposes. uses bash command to hold local dirs in sync.
--
bash = {
maxProcesses = 3,
onStartup =
[[if [ "$(ls -A ^source)" ]; then cp -r ^source* ^target; fi]],
onCreate = prefix..[[cp -r ^sourcePathname ^targetPathname]],
onModify = prefix..[[cp -r ^sourcePathname ^targetPathname]],
onDelete = prefix..[[rm -rf ^targetPathname]],
onMove = prefix..[[mv ^o.targetPathname ^d.targetPathname]],
}
sync{bash, source="src", target="trg/"}

82
examples/lgforce.lua Normal file
View File

@ -0,0 +1,82 @@
-----
-- User configuration file for lsyncd.
--
-- This example refers to a common problem in unix.
--
-- You have a shared directory for a set of users and you want
-- to ensure all users have read and write permissions on all
-- files in there. Unfortunally sometimes users mess with their
-- umask, and create files in there that are not read/write/deleteable
-- by others. Usually this involves frequent handfixes by a sysadmin,
-- or a cron job that recursively chmods/chowns the whole directory.
--
-- This is another approach to use lsyncd to continously fix permissions.
--
-- One second after a file is created/modified it checks for its permissions
-- and forces group permissions on it.
--
-- This example regards more the handcraft of bash scripting than lsyncd.
-- An alternative to this would be to load a Lua-Posix library and do the
-- permission changes right within the onAction handlers.
----
-- forces this group.
--
fgroup = "staff"
-----
-- script for all changes.
--
command =
-- checks if the group is the one enforced and sets them if not
[[
perm=`stat -c %A ^sourcePathname`
if [ `stat -c %G ^sourcePathname` != ]]..fgroup..[[ ]; then
/bin/chgrp ]]..fgroup..[[ ^sourcePathname || /bin/true;
fi
]] ..
-- checks if the group permissions are rw and sets them
[[
if [ `expr match $perm "....rw"` == 0 ]; then
/bin/chmod g+rw ^sourcePathname || /bin/true;
fi
]] ..
-- and forces the executable bit for directories.
[[
if [ -d ^sourcePathname ]; then
if [ `expr match $perm "......x"` == 0 ]; then
/bin/chmod g+x ^^sourcePathname || /bin/true;
fi
fi
]]
-- on startup recursevily sets all group ownerships
-- all group permissions are set to rw
-- and to executable flag for directories
--
-- the hash in the first line is important, otherwise due to the starting
-- slash, Lsyncd would think it is a call to the binary /bin/chgrp only
-- and would optimize the bash away.
--
startup =
[[#
/bin/chgrp -R ]]..fgroup..[[ ^source || /bin/true &&
/bin/chmod -R g+rw ^source || /bin/true &&
/usr/bin/find ^source -type d | xargs chmod g+x
]]
gforce = {
maxProcesses = 99,
delay = 1,
onStartup = startup,
onAttrib = command,
onCreate = command,
onModify = command,
-- does nothing on moves, they won't change permissions
onMove = true,
}
sync{gforce, source="/path/to/share"}

119
examples/limagemagic.lua Normal file
View File

@ -0,0 +1,119 @@
----
-- Lsyncd user-script that creates a "magic" image converter directory.
--
-- This configuration will automatically convert all images that are placed
-- in the directory 'magicdir' all resulting images are placed in the same
-- directory!
--
-- Be sure to mkdir 'magicdir' first.
-----
-- Fileformats: .jpg .gif .png
--
local formats = { jpg=true, gif=true, png=true, }
convert = {
delay = 0,
maxProcesses = 99,
action = function(inlet)
local event = inlet.getEvent()
if event.isdir then
-- ignores events on dirs
inlet.discardEvent(event)
return
end
-- extract extension and basefilename
local p = event.pathname
local ext = string.match(p, ".*%.([^.]+)$")
local base = string.match(p, "(.*)%.[^.]+$")
if not formats[ext] then
-- an unknown extenion
log("Normal", "not doing something on ."..ext)
inlet.discardEvent(event)
return
end
-- autoconvert on create and modify
if event.etype == "Create" or event.etype == "Modify" then
-- builds one bash command
local cmd = ""
-- do for all other extensions
for k, _ in pairs(formats) do
if k ~= ext then
-- excludes files to be created, so no
-- followup actions will occur
inlet.addExclude(base..'.'..k)
if cmd ~= "" then
cmd = cmd .. " && "
end
cmd = cmd..
'/usr/bin/convert "'..
event.source..p..'" "'..
event.source..base..'.'..k..
'" || /bin/true'
end
end
log("Normal", "Converting "..p)
spawnShell(event, cmd)
return
end
-- deletes all formats if you delete one
if event.etype == "Delete" then
-- builds one bash command
local cmd = ""
-- do for all other extensions
for k, _ in pairs(formats) do
if k ~= ext then
-- excludes files to be created, so no
-- followup actions will occur
inlet.addExclude(base..'.'..k)
if cmd ~= "" then
cmd = cmd .. " && "
end
cmd = cmd..
'rm "'..event.source..base..'.'..k..
'" || /bin/true'
end
end
log("Normal", "Deleting all "..p)
spawnShell(event, cmd)
return
end
-- ignores other events.
inlet.discardEvent(event)
end,
-----
-- Removes excludes when convertions are finished
--
collect = function(event, exitcode)
local p = event.pathname
local ext = string.match(p, ".*%.([^.]+)$")
local base = string.match(p, "(.*)%.[^.]+$")
local inlet = event.inlet
if event.etype == "Create" or
event.etype == "Modify" or
event.etype == "Delete"
then
for k, _ in pairs(formats) do
inlet.rmExclude(base..'.'..k)
end
end
end,
-----
-- Does not collapse anything
collapse = function()
return 3
end,
}
sync{convert, source="magicdir", recursive=false}

16
examples/lrsync.lua Normal file
View File

@ -0,0 +1,16 @@
----
-- User configuration file for lsyncd.
--
-- Simple example for default rsync.
--
settings = {
statusFile = "/tmp/lsyncd.stat",
statusIntervall = 1,
}
sync{
default.rsync,
source="src",
target="/home/user/dst/",
}

7
examples/lrsyncssh.lua Normal file
View File

@ -0,0 +1,7 @@
----
-- User configuration file for lsyncd.
--
-- Simple example for default rsync, but executing moves through on the target.
--
sync{default.rsyncssh, source="src", host="localhost", targetdir="dst/"}

View File

@ -1,181 +0,0 @@
/*
* This header is used if <sys/inotify.h> cannot be found.
*
* Inode based directory notification for Linux
*
* Copyright (C) 2005 John McCutchan
*/
#ifndef _LINUX_INOTIFY_H
#define _LINUX_INOTIFY_H
#include <stdint.h>
#include <sys/syscall.h>
#include <unistd.h>
#include <asm/unistd.h>
/*
* struct inotify_event - structure read from the inotify device for each event
*
* When you are watching a directory, you will receive the filename for events
* such as IN_CREATE, IN_DELETE, IN_OPEN, IN_CLOSE, ..., relative to the wd.
*/
struct inotify_event {
int wd; /* watch descriptor */
uint32_t mask; /* watch mask */
uint32_t cookie; /* cookie to synchronize two events */
uint32_t len; /* length (including nulls) of name */
char name __flexarr; /* stub for possible name */
};
/* the following are legal, implemented events that user-space can watch for */
#define IN_ACCESS 0x00000001 /* File was accessed */
#define IN_MODIFY 0x00000002 /* File was modified */
#define IN_ATTRIB 0x00000004 /* Metadata changed */
#define IN_CLOSE_WRITE 0x00000008 /* Writtable file was closed */
#define IN_CLOSE_NOWRITE 0x00000010 /* Unwrittable file closed */
#define IN_OPEN 0x00000020 /* File was opened */
#define IN_MOVED_FROM 0x00000040 /* File was moved from X */
#define IN_MOVED_TO 0x00000080 /* File was moved to Y */
#define IN_CREATE 0x00000100 /* Subfile was created */
#define IN_DELETE 0x00000200 /* Subfile was deleted */
#define IN_DELETE_SELF 0x00000400 /* Self was deleted */
#define IN_MOVE_SELF 0x00000800 /* Self was moved */
/* the following are legal events. they are sent as needed to any watch */
#define IN_UNMOUNT 0x00002000 /* Backing fs was unmounted */
#define IN_Q_OVERFLOW 0x00004000 /* Event queued overflowed */
#define IN_IGNORED 0x00008000 /* File was ignored */
/* helper events */
#define IN_CLOSE (IN_CLOSE_WRITE | IN_CLOSE_NOWRITE) /* close */
#define IN_MOVE (IN_MOVED_FROM | IN_MOVED_TO) /* moves */
/* special flags */
#define IN_ONLYDIR 0x01000000 /* only watch the path if it is a directory */
#define IN_DONT_FOLLOW 0x02000000 /* don't follow a sym link */
#define IN_MASK_ADD 0x20000000 /* add to the mask of an already existing watch */
#define IN_ISDIR 0x40000000 /* event occurred against dir */
#define IN_ONESHOT 0x80000000 /* only send event once */
/*
* All of the events - we build the list by hand so that we can add flags in
* the future and not break backward compatibility. Apps will get only the
* events that they originally wanted. Be sure to add new events here!
*/
#define IN_ALL_EVENTS (IN_ACCESS | IN_MODIFY | IN_ATTRIB | IN_CLOSE_WRITE | \
IN_CLOSE_NOWRITE | IN_OPEN | IN_MOVED_FROM | \
IN_MOVED_TO | IN_DELETE | IN_CREATE | IN_DELETE_SELF | \
IN_MOVE_SELF)
#if 0
#if defined (__alpha__)
# define __NR_inotify_init 444
# define __NR_inotify_add_watch 445
# define __NR_inotify_rm_watch 446
#elif defined (__arm__)
# define __NR_inotify_init (__NR_SYSCALL_BASE+316)
# define __NR_inotify_add_watch (__NR_SYSCALL_BASE+317)
# define __NR_inotify_rm_watch (__NR_SYSCALL_BASE+318)
#elif defined (__frv__)
# define __NR_inotify_init 291
# define __NR_inotify_add_watch 292
# define __NR_inotify_rm_watch 293
#elif defined(__i386__)
# define __NR_inotify_init 291
# define __NR_inotify_add_watch 292
# define __NR_inotify_rm_watch 293
#elif defined (__ia64__)
# define __NR_inotify_init 1277
# define __NR_inotify_add_watch 1278
# define __NR_inotify_rm_watch 1279
#elif defined (__mips__)
# if _MIPS_SIM == _MIPS_SIM_ABI32
# define __NR_inotify_init (__NR_Linux + 284)
# define __NR_inotify_add_watch (__NR_Linux + 285)
# define __NR_inotify_rm_watch (__NR_Linux + 286)
# endif
# if _MIPS_SIM == _MIPS_SIM_ABI64
# define __NR_inotify_init (__NR_Linux + 243)
# define __NR_inotify_add_watch (__NR_Linux + 243)
# define __NR_inotify_rm_watch (__NR_Linux + 243)
# endif
# if _MIPS_SIM == _MIPS_SIM_NABI32
# define __NR_inotify_init (__NR_Linux + 247)
# define __NR_inotify_add_watch (__NR_Linux + 248)
# define __NR_inotify_rm_watch (__NR_Linux + 249)
# endif
#elif defined(__parisc__)
# define __NR_inotify_init (__NR_Linux + 269)
# define __NR_inotify_add_watch (__NR_Linux + 270)
# define __NR_inotify_rm_watch (__NR_Linux + 271)
#elif defined(__powerpc__) || defined(__powerpc64__)
# define __NR_inotify_init 275
# define __NR_inotify_add_watch 276
# define __NR_inotify_rm_watch 277
#elif defined (__s390__)
# define __NR_inotify_init 284
# define __NR_inotify_add_watch 285
# define __NR_inotify_rm_watch 286
#elif defined (__sh__)
# define __NR_inotify_init 290
# define __NR_inotify_add_watch 291
# define __NR_inotify_rm_watch 292
#elif defined (__sh64__)
# define __NR_inotify_init 318
# define __NR_inotify_add_watch 319
# define __NR_inotify_rm_watch 320
#elif defined (__sparc__) || defined (__sparc64__)
# define __NR_inotify_init 151
# define __NR_inotify_add_watch 152
# define __NR_inotify_rm_watch 156
#elif defined(__x86_64__)
# define __NR_inotify_init 253
# define __NR_inotify_add_watch 254
# define __NR_inotify_rm_watch 255
#else
# error "Unsupported architecture!"
#endif
#endif
#ifndef __NR_inotify_init
# error "Unsupported architecture!"
#endif
#ifndef __NR_inotify_add_watch
# error "Unsupported architecture!"
#endif
#ifndef __NR_inotify_rm_watch
# error "Unsupported architecture!"
#endif
static inline int inotify_init (void)
{
return syscall (__NR_inotify_init);
}
static inline int inotify_add_watch (int fd, const char *name, uint32_t mask)
{
return syscall (__NR_inotify_add_watch, fd, name, mask);
}
static inline int inotify_rm_watch (int fd, uint32_t wd)
{
return syscall (__NR_inotify_rm_watch, fd, wd);
}
#endif /* _LINUX_INOTIFY_H */

View File

@ -1,269 +0,0 @@
#!/bin/sh
#
# install - install a program, script, or datafile
#
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
# following copyright and license.
#
# Copyright (C) 1994 X Consortium
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to
# deal in the Software without restriction, including without limitation the
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
# sell copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
#
# Except as contained in this notice, the name of the X Consortium shall not
# be used in advertising or otherwise to promote the sale, use or other deal-
# ings in this Software without prior written authorization from the X Consor-
# tium.
#
#
# FSF changes to this file are in the public domain.
#
# Calling this script install-sh is preferred over install.sh, to prevent
# `make' implicit rules from creating a file called install from it
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
# from scratch. It can only install one file at a time, a restriction
# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
doit="${DOITPROG-}"
# put in absolute paths if you don't have them in your path; or use env. vars.
mvprog="${MVPROG-mv}"
cpprog="${CPPROG-cp}"
chmodprog="${CHMODPROG-chmod}"
chownprog="${CHOWNPROG-chown}"
chgrpprog="${CHGRPPROG-chgrp}"
stripprog="${STRIPPROG-strip}"
rmprog="${RMPROG-rm}"
mkdirprog="${MKDIRPROG-mkdir}"
transformbasename=""
transform_arg=""
instcmd="$mvprog"
chmodcmd="$chmodprog 0755"
chowncmd=""
chgrpcmd=""
stripcmd=""
rmcmd="$rmprog -f"
mvcmd="$mvprog"
src=""
dst=""
dir_arg=""
while [ x"$1" != x ]; do
case $1 in
-c) instcmd="$cpprog"
shift
continue;;
-d) dir_arg=true
shift
continue;;
-m) chmodcmd="$chmodprog $2"
shift
shift
continue;;
-o) chowncmd="$chownprog $2"
shift
shift
continue;;
-g) chgrpcmd="$chgrpprog $2"
shift
shift
continue;;
-s) stripcmd="$stripprog"
shift
continue;;
-t=*) transformarg=`echo $1 | sed 's/-t=//'`
shift
continue;;
-b=*) transformbasename=`echo $1 | sed 's/-b=//'`
shift
continue;;
*) if [ x"$src" = x ]
then
src=$1
else
# this colon is to work around a 386BSD /bin/sh bug
:
dst=$1
fi
shift
continue;;
esac
done
if [ x"$src" = x ]
then
echo "install: no input file specified"
exit 1
else
true
fi
if [ x"$dir_arg" != x ]; then
dst=$src
src=""
if [ -d $dst ]; then
instcmd=:
chmodcmd=""
else
instcmd=mkdir
fi
else
# Waiting for this to be detected by the "$instcmd $src $dsttmp" command
# might cause directories to be created, which would be especially bad
# if $src (and thus $dsttmp) contains '*'.
if [ -f $src -o -d $src ]
then
true
else
echo "install: $src does not exist"
exit 1
fi
if [ x"$dst" = x ]
then
echo "install: no destination specified"
exit 1
else
true
fi
# If destination is a directory, append the input filename; if your system
# does not like double slashes in filenames, you may need to add some logic
if [ -d $dst ]
then
dst="$dst"/`basename $src`
else
true
fi
fi
## this sed command emulates the dirname command
dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
# Make sure that the destination directory exists.
# this part is taken from Noah Friedman's mkinstalldirs script
# Skip lots of stat calls in the usual case.
if [ ! -d "$dstdir" ]; then
defaultIFS='
'
IFS="${IFS-${defaultIFS}}"
oIFS="${IFS}"
# Some sh's can't handle IFS=/ for some reason.
IFS='%'
set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'`
IFS="${oIFS}"
pathcomp=''
while [ $# -ne 0 ] ; do
pathcomp="${pathcomp}${1}"
shift
if [ ! -d "${pathcomp}" ] ;
then
$mkdirprog "${pathcomp}"
else
true
fi
pathcomp="${pathcomp}/"
done
fi
if [ x"$dir_arg" != x ]
then
$doit $instcmd $dst &&
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi
else
# If we're going to rename the final executable, determine the name now.
if [ x"$transformarg" = x ]
then
dstfile=`basename $dst`
else
dstfile=`basename $dst $transformbasename |
sed $transformarg`$transformbasename
fi
# don't allow the sed command to completely eliminate the filename
if [ x"$dstfile" = x ]
then
dstfile=`basename $dst`
else
true
fi
# Make a temp file name in the proper directory.
dsttmp=$dstdir/#inst.$$#
# Move or copy the file name to the temp name
$doit $instcmd $src $dsttmp &&
trap "rm -f ${dsttmp}" 0 &&
# and set any options; do chmod last to preserve setuid bits
# If any of these fail, we abort the whole thing. If we want to
# ignore errors from any of these, just make sure not to ignore
# errors from the above "$doit $instcmd $src $dsttmp" command.
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi &&
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi &&
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi &&
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi &&
# Now rename the file to the real destination.
$doit $rmcmd -f $dstdir/$dstfile &&
$doit $mvcmd $dsttmp $dstdir/$dstfile
fi &&
exit 0

4477
lsyncd.c

File diff suppressed because it is too large Load Diff

View File

@ -1,81 +0,0 @@
<lsyncd version="1">
<!--
This is a default config file template for lsyncd.
Actually all settings are optional, if you delete them
lsyncd will use the option value (which is likely identical
to the values specified as defaults in this template)
- Happy Syncing! -
-->
<settings>
<!--uncomment to log all debug messages.-->
<!--debug/-->
<!--uncomment to log only errors.-->
<!--scarce/-->
<!--uncomment to not detach, log to stdout/stderr.-->
<!--no-daemon/-->
<!--uncomment to not call any actions, run dry only.-->
<!--dryrun/-->
<!--uncomment to exclude file handled to rsync.-->
<!--exclude-from filename="/tmp/exclude"/-->
<!-- the file to log messages -->
<logfile filename="/var/log/lsyncd"/>
<!--Specify the rsync (or other) binary to call-->
<binary filename="/usr/bin/rsync"/>
<!--uncomment to create a file containing pid of the daemon-->
<!--pidfile filename="/var/run/lsyncd.pid"/-->
<!--this specifies the arguments handled to the rsync (or other)
binary.
option is the default literal.
only '%r' will be replaced with r when recursive
operation is wanted, d when not.
exclude-file will be replaced with -exclude-from FILE
source will be the source path to sync from
destination will be the destination path to sync to -->
<callopts>
<option text="-lts%r"/>
<option text="--delete"/>
<exclude-file/>
<file-filter/>
<source/>
<destination/>
</callopts>
</settings>
<directory>
<source path="/absolute/path/to/source"/>
<target path="desthost::module/"/>
<!--
or it can also be an absolute path for localhost
<target path="/absolute/path/to/target">
-->
</directory>
<!--
You can specify even more than one source/destination pair,
all will be synced.
Please take care you do not make any with other source/target pairs.
-->
<!--directory>
<source path="/home/axel/lsyncd-svn/3"/>
<target path="/home/axel/lsyncd-svn/4"/>
</directory-->
</lsyncd>

2706
lsyncd.lua Normal file

File diff suppressed because it is too large Load Diff

6871
ltmain.sh

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
#! /bin/sh
# mkinstalldirs --- make directory hierarchy
# Author: Noah Friedman <friedman@prep.ai.mit.edu>
# Created: 1993-05-16
# Public domain
# $Id: mkinstalldirs,v 1.13 1999/01/05 03:18:55 bje Exp $
errstatus=0
for file
do
set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'`
shift
pathcomp=
for d
do
pathcomp="$pathcomp$d"
case "$pathcomp" in
-* ) pathcomp=./$pathcomp ;;
esac
if test ! -d "$pathcomp"; then
echo "mkdir $pathcomp"
mkdir "$pathcomp" || lasterr=$?
if test ! -d "$pathcomp"; then
errstatus=$lasterr
fi
fi
pathcomp="$pathcomp/"
done
done
exit $errstatus
# mkinstalldirs ends here

View File

@ -1,62 +0,0 @@
#!/bin/bash
set -e
CON="\E[47;34m"
COFF="\033[0m"
echo -e "$CON***************************************************************$COFF"
echo -e "$CON** Testing the case of directory being cp -r'ed and touched. **$COFF"
echo -e "$CON** With zero delay **$COFF"
echo -e "$CON***************************************************************$COFF"
WORKSOURCE=$(mktemp -d)
WORKTARGET=$(mktemp -d)
PIDFILE=$(mktemp)
LOGFILE=$(mktemp)
echo -e "$CON* populating the filesystem$COFF"
mkdir -p "${WORKSOURCE}"/a/a
echo 'test' > "${WORKSOURCE}"/a/a/file
echo -e "$CON* starting lsyncd$COFF"
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" --no-daemon --delay 0 "${WORKSOURCE}" "${WORKTARGET}"&
echo -e "$CON* waiting for lsyncd to start$COFF"
sleep 4s
# cp -r the directory
echo -e "$CON* making a lot of data$COFF"
for A in 1 2 3 4 5 6 7 8 9 10; do
cp -r "${WORKSOURCE}"/a "${WORKSOURCE}"/b${A}
echo 'test2' > "${WORKSOURCE}"/b${A}/a/another
done
mkdir -p "${WORKSOURCE}"/c/a
echo 'test3' > "${WORKSOURCE}"/c/a/file
for A in 1 2 3 4 5 6 7 8 9 10; do
cp -r "${WORKSOURCE}"/c "${WORKSOURCE}"/d${A}
echo 'test2' > "${WORKSOURCE}"/d${A}/a/another
done
echo -e "$CON*waiting until lsyncd does the job.$COFF"
sleep 20s
echo -e "$CON*killing lsyncd$COFF"
LSYNCPID=$(cat "${PIDFILE}")
if ! kill "${LSYNCPID}"; then
cat "${LOGFILE}"
diff -urN "${WORKSOURCE}" "${WORKTARGET}" || true
echo "kill failed"
exit 1
fi
sleep 1s
#echo "log file contents"
#cat "${LOGFILE}"
##this should be grep.
echo -e "$CON*differences$COFF"
diff -urN "${WORKSOURCE}" "${WORKTARGET}"
rm "${PIDFILE}"
rm "${LOGFILE}"
rm -rf "${WORKTARGET}"
rm -rf "${WORKSOURCE}"

View File

@ -1,63 +0,0 @@
#!/bin/bash
set -e
CON="\E[47;34m"
COFF="\033[0m"
echo -e "$CON************************************************************$COFF"
echo -e "$CON** Testing the case of directory being moved and removed. **$COFF"
echo -e "$CON************************************************************$COFF"
WORKSOURCE=$(mktemp -d)
WORKTARGET=$(mktemp -d)
PIDFILE=$(mktemp)
LOGFILE=$(mktemp)
echo $WORKSOURCE
echo $WORKTARGET
echo $PIDFILE
echo -e "$CON* populating the filesystem.$COFF"
mkdir "${WORKSOURCE}"/a
mkdir "${WORKSOURCE}"/b
touch "${WORKSOURCE}"/a/f
touch "${WORKSOURCE}"/b/g
echo -e "$CON* starting lsyncd.$COFF"
./lsyncd --no-daemon --logfile "${LOGFILE}" --pidfile "${PIDFILE}" "${WORKSOURCE}" "${WORKTARGET}"&
LSYNCPID=$(cat "${PIDFILE}")
echo -e "$CON* waiting for lsyncd to start.$COFF"
sleep 4s
# move a file
echo -e "$CON* moving a directory$COFF"
mv "${WORKSOURCE}"/a "${WORKSOURCE}"/c
echo -e "$CON* creating a file there$COFF"
touch "${WORKSOURCE}"/c/h
echo -e "$CON* and deleting a directory$COFF"
rm -r "${WORKSOURCE}"/b
echo -e "$CON* waiting for lsyncd to do the job.$COFF"
sleep 20s
echo -e "$CON* killing lsyncd$COFF"
if ! kill "${LSYNCPID}"; then
cat "${LOGFILE}"
diff -ur "${WORKSOURCE}" "${WORKTARGET}" || true
echo "kill failed"
exit 1
fi
sleep 1s
echo -e "$CON* log file contents$COFF"
cat "${LOGFILE}"
echo -e "$CON* differences$COFF"
diff -ur "${WORKSOURCE}" "${WORKTARGET}"
rm "${PIDFILE}"
rm "${LOGFILE}"
rm -rf "${WORKTARGET}"
rm -rf "${WORKSOURCE}"

View File

@ -1,14 +0,0 @@
#!/bin/bash
# copyright 2008 Junichi Uekawa <dancer@debian.org>
# licensed under GPLv2 or later, see the file ../COPYING for details.
set -e
CON="\E[47;34m"
COFF="\033[0m"
echo -e "$CON*****************************************************************$COFF"
echo -e "$CON* Testing that --help outputs help message and exit code of 0. **$COFF"
echo -e "$CON*****************************************************************$COFF"
set -o pipefail
# assume that USAGE being in output is good enough.
./lsyncd --help | grep '^USAGE:'

View File

@ -1,26 +1,25 @@
#!/bin/bash
set -e
CON="\E[47;34m"
COFF="\033[0m"
C1="\E[47;34m"
C0="\033[0m"
echo -e "$CON***************************************************************$COFF"
echo -e "$CON** Testing the case of directory being cp -r'ed and touched. **$COFF"
echo -e "$CON** With default delay **$COFF"
echo -e "$CON***************************************************************$COFF"
WORKSOURCE=$(mktemp -d)
WORKTARGET=$(mktemp -d)
PIDFILE=$(mktemp)
LOGFILE=$(mktemp)
echo -e "$CON* populating the filesystem$COFF"
mkdir -p "${WORKSOURCE}"/a/a
echo 'test' > "${WORKSOURCE}"/a/a/file
echo -e "$CON* starting lsyncd$COFF"
echo -e "$C1****************************************************************$C0"
echo -e "$C1 Testing layer 4 default rsync with simulated data activity $C0"
echo -e "$C1****************************************************************$C0"
echo
#root tmp dir
R=$(mktemp -d)
#source dir
S=$R/source
#target dir
T=$R/target
echo -e "$C1* using root dir for test $R$C0"
echo -e "$C1* populating the source$C0"
mkdir -p "$S"/d1/d11
echo 'test' > "$S"/d1/d11/f1
echo -e "$C1* starting lsyncd$C0"
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" --verbose --no-daemon "${WORKSOURCE}" "${WORKTARGET}"&
echo -e "$CON* waiting for lsyncd to start$COFF"
echo -e "$C1* waiting for lsyncd to start$C0"
sleep 4s
# cp -r the directory

View File

@ -1,29 +0,0 @@
#!/bin/bash
set -e
CON="\E[47;34m"
COFF="\033[0m"
echo -e "$CON**************************************************$COFF"
echo -e "$CON** Checking if lsyncd writes a correct pidfile. **$COFF"
echo -e "$CON**************************************************$COFF"
WORKTARGET=$(mktemp -d)
PIDFILE=$(mktemp)
LOGFILE=$(mktemp)
./lsyncd --logfile "${LOGFILE}" --pidfile "${PIDFILE}" . "${WORKTARGET}"
sleep 1s
LSYNCPID=$(cat "${PIDFILE}")
if ! kill "${LSYNCPID}"; then
echo "kill failed"
exit 1
fi
sleep 1s
if kill "${LSYNCPID}"; then
echo process still exists after kill
exit 1
fi
rm "${PIDFILE}"
rm "${LOGFILE}"
rm -rf "${WORKTARGET}"

View File

@ -1,15 +0,0 @@
#!/bin/bash
# copyright 2008 Junichi Uekawa <dancer@debian.org>
# licensed under GPLv2 or later, see the file ../COPYING for details.
set -e
CON="\E[47;34m"
COFF="\033[0m"
echo -e "$CON******************************************************************************$COFF"
echo -e "$CON* Testing that --version outputs some kind of version message and exit code 0.$COFF"
echo -e "$CON******************************************************************************$COFF"
set -o pipefail
./lsyncd --version | grep '^Version: '

View File

@ -1,20 +0,0 @@
#!/bin/bash
# copyright 2008 Junichi Uekawa <dancer@debian.org>
# licensed under GPLv2 or later, see the file ../COPYING for details.
set -e
CON="\E[47;34m"
COFF="\033[0m"
echo -e "$CON*****************************************************************$COFF"
echo -e "$CON* Testing that a wrong logfile spec. gives a reasonable error. **$COFF"
echo -e "$CON*****************************************************************$COFF"
WORKTARGET=$(mktemp -d)
if [[ $( ./lsyncd --logfile /nonexisting/path/name . "${WORKTARGET}" 2>&1 ) == "cannot open logfile [/nonexisting/path/name]!" ]]; then
rmdir "${WORKTARGET}"
exit 0;
else
rmdir "${WORKTARGET}"
exit 1;
fi

View File

@ -1,20 +0,0 @@
#!/bin/bash
# copyright 2008 Junichi Uekawa <dancer@debian.org>
# licensed under GPLv2 or later, see the file ../COPYING for details.
#set -e <- explicitly not!
CON="\E[47;34m"
COFF="\033[0m"
echo -e "$CON******************************************************************$COFF"
echo -e "$CON* Testing if lsyncd exits with -1 when the rsync path is wrong. **$COFF"
echo -e "$CON******************************************************************$COFF"
WORKTARGET=$(mktemp -d)
./lsyncd --no-daemon --binary /wrong/path/to/rsync . "${WORKTARGET}"
if [[ $? = 3 ]]; then
rmdir "${WORKTARGET}"
exit 0;
else
exit 1;
fi