Reputation: 350
I have lsyncd running on my main server, to sync files on all servers. But when I add another folder to be synced, the service won't start again. I can't seem to find any errors in logs. I'm no Lua expert, so might be something obvious I'm missing.
This is my orignal script, that works:
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status",
statusInterval = 10
}
servers = {
"[email protected]",
"[email protected]"
}
for _, server in ipairs(servers) do
sync {
default.rsyncssh,
source="/path/to/source/folder/one",
host=server,
targetdir="/path/to/target/folder/one",
excludeFrom="/etc/lsyncd/lsyncd-excludes.txt",
rsync = {
compress = true,
archive = true,
verbose = true,
rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"
}
}
end
This is the script that doesn't work, where I have added another folder:
settings {
logfile = "/var/log/lsyncd/lsyncd.log",
statusFile = "/var/log/lsyncd/lsyncd.status",
statusInterval = 10
}
servers = {
"[email protected]",
"[email protected]"
}
for _, server in ipairs(servers) do
sync {
default.rsyncssh,
source="/path/to/source/folder/one",
host=server,
targetdir="/path/to/target/folder/one",
excludeFrom="/etc/lsyncd/lsyncd-excludes.txt",
rsync = {
compress = true,
archive = true,
verbose = true,
rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"
}
}
sync {
default.rsyncssh,
source="/path/to/source/folder/two",
host=server,
targetdir="/path/to/target/folder/two",
excludeFrom="/etc/lsyncd/lsyncd-excludes.txt",
rsync = {
compress = true,
archive = true,
verbose = true,
rsh = "/usr/bin/ssh -p 22 -o StrictHostKeyChecking=no"
}
}
end
I've also tried putting them in two different loops, but still no luck. Spent hours scraping the internet for answers, but everything I find points to I'm doing it correctly.
Upvotes: 1
Views: 1540
Reputation: 1
I don't know if you or someone else is having the same issue, but did you try including the second sync field into the first one?
i.e. enclosing the second sync into the first: sync { ... sync { ... } }
At least that is how I got mine to work with multiple directories.
Upvotes: 0