mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-04 19:03:17 +00:00
multi targets
This commit is contained in:
parent
d6dd37b5bb
commit
8a03b772ea
@ -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)
|
||||
|
32
faq/multiple-targets/index.md
Normal file
32
faq/multiple-targets/index.md
Normal file
@ -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](../)
|
@ -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.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user