updating for lsyncd 3

This commit is contained in:
Axel Kittenberger 2018-03-13 15:53:32 +01:00
parent 48a42bd7a1
commit a0b5eaa47c
3 changed files with 29 additions and 64 deletions

View File

@ -13,15 +13,12 @@ For example, the following code will instruct Lsyncd to log into ```/tmp/lsyncd.
{% highlight lua %}
settings {
logfile = "/tmp/lsyncd.log",
statusFile = "/tmp/lsyncd.status",
logfile = '/tmp/lsyncd.log',
statusFile = '/tmp/lsyncd.status',
nodaemon = true,
}
{% endhighlight %}
**Caution**
If you are upgrading from 2.0.x, please notice that `settings` became a function from a variable, so you **MUST** delete the equal sign '=' between `settings` and the `{`.
Valid keys for settings are:
<table>
@ -30,18 +27,6 @@ Valid keys for settings are:
</td><td> =
</td><td> FILENAME
</td><td> logs into this file
</td></tr>
<tr><td> pidfile
</td><td> =
</td><td> FILENAME
</td><td> logs PID into this file
</td></tr>
<tr><td> nodaemon
</td><td> =
</td><td> BOOL
</td><td> does not detach
</td></tr>
<tr><td> statusFile
@ -66,12 +51,6 @@ Valid keys for settings are:
</td><td> =
</td><td> STRING
</td><td> syslog identification (tag), default "lsyncd"
</td></tr>
<tr><td> insist
</td><td> =
</td><td> BOOL
</td><td> keep running at startup although one or more targets failed due to not being reachable.
</td></tr>
<tr><td> inotifyMode

View File

@ -1,7 +1,7 @@
---
layout: default3
title: "Config Layer 4: Default Config"
short: "Config Layer 4"
short: "Config Layer 4"
---
You can simply choose from a set of three default implementations which are: __rsync__, __rsyncssh__ and __direct__.
@ -49,7 +49,7 @@ sync {
default.rsync,
source = "/home/user/src/",
target = "foohost.com:~/trg/",
delay = 15,
delay = 15,
rsync = {
binary = "/usr/local/bin/rsync",
archive = true,
@ -67,7 +67,7 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
</td><td> <b>default value</b>
</td><td> <b>comment</b>
</td></tr>
<tr><td> acls
</td><td> =
</td><td> BOOL
@ -172,18 +172,18 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
</td><td>
</td></tr>
<tr><td> exclude
<tr><td> filter
</td><td> =
</td><td> PATTERN
</td><td>
</td><td> TABLE of PATTERNs also allowed
</td><td> LIST of RULEs
</td><td>
</td><td>
</td></tr>
<tr><td> excludeFrom
<tr><td> filterFrom
</td><td> =
</td><td> FILENAME
</td><td>
</td><td>
</td><td>
</td></tr>
<tr><td> executability
@ -203,7 +203,7 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
<tr><td> groupmap
</td><td> =
</td><td> STRING
</td><td>
</td><td>
</td><td> (Lsyncd >= 2.2.0)
</td></tr>
@ -232,21 +232,21 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
</td><td> =
</td><td> BOOL
</td><td> false
</td><td>
</td><td>
</td></tr>
<tr><td> ipv6
</td><td> =
</td><td> BOOL
</td><td> false
</td><td>
</td><td>
</td></tr>
<tr><td> links
</td><td> =
</td><td> BOOL
</td><td> true
</td><td>
</td><td>
</td></tr>
<tr><td> one_file_system
@ -266,7 +266,7 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
<tr><td> password_file
</td><td> =
</td><td> FILENAME
</td><td>
</td><td>
</td><td> (Lsyncd >= 2.1.2)
</td></tr>
@ -301,14 +301,14 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
<tr><td> rsh
</td><td> =
</td><td> COMMAND
</td><td>
</td><td>
</td><td>
</td><td>
</td></tr>
<tr><td> rsync_path
</td><td> =
</td><td> PATH
</td><td>
</td><td>
</td><td> (path to rsync on remote host)
</td></tr>
@ -322,14 +322,14 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
<tr><td> suffix
</td><td> =
</td><td> SUFFIX
</td><td>
</td><td>
</td><td> (Lsyncd >= 2.2.0)
</td></tr>
<tr><td> temp_dir
</td><td> =
</td><td> DIR
</td><td>
</td><td>
</td><td>
</td></tr>
@ -337,7 +337,7 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
</td><td> =
</td><td> BOOL
</td><td> true
</td><td>
</td><td>
</td></tr>
<tr><td> update
@ -373,20 +373,13 @@ Below is a table of options for the ```rsync``` parameter. Please have a look at
</td><td> BOOL
</td><td> false
</td><td>
</td></tr>
<tr><td> _extra
</td><td> =
</td><td> TABLE of STRINGS.
</td><td>
</td><td> If absolutely needed, additional arguments can be specified as a TABLE of STRINGS(example: <tt>{ "--omit-dir-times", "--omit-link-times" }</tt>). Note that the underscore highlights this as workaround. If you need something that is not covered by the above options, please request it via a feature request on the project website. Most notably, do not add -r for recursive or -a which implies recursive, since Lsyncd will handle that by itself. Additionally do not add -R for relative, which will ruin Lsyncd &lt;-&gt; Rsync communication.
</td></tr>
</table>
default.rsyncssh
----------------
This configuration differs from the standard rsync configuration in that it uses ssh commands to move files or directories locally at the target host instead of deleting and transferring again. This configuration does spawn Rsync processes like default.rsync but additionally will spawn ```/usr/bin/ssh HOST mv ORIGIN DESTINATION``` commands.
This configuration differs from the standard rsync configuration in that it uses ssh commands to move files or directories locally at the target host instead of deleting and transferring again. This configuration does spawn Rsync processes like default.rsync but additionally will spawn ```/usr/bin/ssh HOST mv ORIGIN DESTINATION``` commands.
Different to default.rsync it does not take an uniform ```target``` parameter, but needs ```host``` and ```targetdir``` separated.
@ -441,7 +434,7 @@ sync {
default.rsyncssh,
source="/srcdir",
host="remotehost",
excludeFrom="/etc/lsyncd.exclude",
filterFrom="/etc/lsyncd.filter",
targetdir="/dstdir",
rsync = {
archive = true,
@ -515,13 +508,13 @@ Two additional parameters can be specified to sync{}:
<table>
<tr><td> excludeFrom
<tr><td> filterFrom
</td><td> =
</td><td> FILENAME
</td><td> loads exclusion rules from this file, on rule per line
</td></tr>
<tr><td> exclude
<tr><td> filter
</td><td> =
</td><td> LIST
</td><td> loads exclusion rules from this list of strings

View File

@ -2,7 +2,7 @@
layout: default3
title: Invoking
---
As most Unix tools, Lsyncd will print a synopsis of its command line options when called with --help.
As most Unix tools, Lsyncd will print a synopsis of its command line options when called with --help.
{% highlight shell %}
lsyncd --help
@ -17,13 +17,13 @@ Also like most Unix tools, ```--version``` or ```-version``` will let Lsyncd pri
lsyncd -version
{% endhighlight %}
Lsyncd 2.1 is configured through a config file.
Lsyncd 3 is configured through at least one config file.
{% highlight shell %}
lsyncd CONFIGFILE
{% endhighlight %}
A disadvantage with Rsync synchronization is that normally directory and file moves result in a deletion of the move origin and a retransfer of the move destination of the wire. However, Lsyncd 2 can use ssh commands to move the directories and files locally on the target. To use this use ```-rsyncssh``` followed by the local source directory, the remote host and the target directory there. The REMOTEHOST can include a user like ```me@remotehost.com```.
A disadvantage with Rsync synchronization is that normally directory and file moves result in a deletion of the move origin and a retransfer of the move destination of the wire. However, Lsyncd 3 can use ssh commands to move the directories and files locally on the target. To use this use ```-rsyncssh``` followed by the local source directory, the remote host and the target directory there. The REMOTEHOST can include a user like ```me@remotehost.com```.
There is a difference in behaviour when running with -nodaemon. Lsyncd will not change its working directory to ```/```, as it does when becoming a daemon. Thus relative targets like ```./target``` will work with ```-nodaemon``` but must be specified to absolute paths to work in daemon mode. The source directories will also be turned into absolute paths by Lsyncd. The reason targets are not resolved to absolute paths while sources are is because Lsyncd itself does not care about the format of the target specifier which can also be remote hosts, rsyncd modules, etc. It is opaquely handed to rsync. It cares about the observed directories though.
@ -39,10 +39,3 @@ This might easily become too much. A particularly useful category is "Exec" whic
lsyncd -log Exec CONFIGFILE
{% endhighlight %}
When the initial startup sync fails by default Lsyncd will terminate with an error message. It has been designed this way, so configuration failures are visibly reported to a possibly beginning user. However, in production a remote target might be done, but you want Lsyncd to start nevertheless and keep trying to sync to the remote target until it is up.
{% highlight shell %}
lsyncd -insist -rsync /home/USER/src remotehost:dst
{% endhighlight %}
In production mode it is recommended to have insist on. It can also be specified in the settings{} command in a config file.