diff --git a/faq/index.md b/faq/index.md index 848595e..500cbad 100644 --- a/faq/index.md +++ b/faq/index.md @@ -4,4 +4,5 @@ title: Frequently Asked Questions short: FAQ --- * [How can I call a script after each rsync operation?](postscript) - * [The startup sync works but after that Lsyncd doesn't do anything](nothing-after-startup) + * [How can I sync from one source to multiple targets?](multiple-targets) + * [The startup sync works but after that Lsyncd doesn't do anything!](nothing-after-startup) diff --git a/faq/multiple-targets/index.md b/faq/multiple-targets/index.md new file mode 100644 index 0000000..c9284e8 --- /dev/null +++ b/faq/multiple-targets/index.md @@ -0,0 +1,32 @@ +--- +layout: default +title: "FAQ: How can I sync from one source to multiple targets?" +--- +If you got multiple targets, you simple specify the sync command multiple times. + +{% highlight lua %} +sync{ default.rsync, source='/sourcedir', target='targethost1:/targetdir' } +sync{ default.rsync, source='/sourcedir', target='targethost2:/targetdir' } +sync{ default.rsync, source='/sourcedir', target='targethost3:/targetdir' } +{% endhighlight %} + +Lsyncd will notice multiple uses of the same source directory or the use of a subdirectory of an already used source directory and creates only watch per subdirectoy watched in any sync. + +To remedy the multiplication of the same configuration you can even use a loop to configure multiple targets. + +This is the same configuration as before using a loop: + +{% highlight lua %} +targets = { + 'targethost1:/targetdir', + 'targethost2:/targetdir', + 'targethost3:/targetdir', +} + +for _, target in ipairs( targets ) +do + sync{ default.rsync, source='/sourcedir', target=target } +end +{% endhighlight %} + +## [‹‹ back to FAQ index](../) diff --git a/faq/nothing-after-startup/index.md b/faq/nothing-after-startup/index.md index 64801db..119b258 100644 --- a/faq/nothing-after-startup/index.md +++ b/faq/nothing-after-startup/index.md @@ -1,6 +1,6 @@ --- layout: default -title: "FAQ: The startup sync works but after that Lsyncd doesn't do anything" +title: "FAQ: The startup sync works but after that Lsyncd doesn't do anything!" --- This almost always caused by the fact you specified a network mounted directory as source.