From c604285f6340aeaf0c12ad2a985ad7184e630a0b Mon Sep 17 00:00:00 2001 From: Axel Kittenberger Date: Wed, 24 Nov 2010 21:26:41 +0000 Subject: [PATCH] fixing rsyncssh --- lsyncd.lua | 22 +++++++++++++++------- tests/churn-rsync.lua | 3 +++ tests/churn-rsyncssh.lua | 5 ++++- 3 files changed, 22 insertions(+), 8 deletions(-) diff --git a/lsyncd.lua b/lsyncd.lua index 09a7d9e..287ac5e 100644 --- a/lsyncd.lua +++ b/lsyncd.lua @@ -2547,7 +2547,7 @@ local default_rsync = { spawn(elist, "/usr/bin/rsync", "<", filterS, config.rsyncOps, - "-rv", + "-r", "--delete", "--force", "--include-from=-", @@ -2638,9 +2638,9 @@ local default_rsyncssh = { local sPaths = table.concat(paths, "\n") log("Normal", "Deleting list\n", sPaths) - spawn(event, "/usr/bin/ssh", + spawn(elist, "/usr/bin/ssh", "<", sPaths, - config.host, "xargs", "echo", "rm -rf") + config.host, "xargs", "rm -rf") return end @@ -2649,10 +2649,18 @@ local default_rsyncssh = { function(e) return e.etype ~= "Move" and e.etype ~= "Delete" end) - local paths = table.concat(elist.getPaths(), "\n") - log("Normal", "Rsyncing list\n", paths) + local paths = elist.getPaths() + + -- removes trailing slashes from dirs. + for k, v in ipairs(paths) do + if string.byte(v, -1) == 47 then + paths[k] = string.sub(v, 1, -2) + end + end + local sPaths = table.concat(paths, "\n") -- TODO 0 delimiter + log("Normal", "Rsyncing list\n", sPaths) spawn(elist, "/usr/bin/rsync", - "<", paths, + "<", sPaths, config.rsyncOps, "--files-from=-", config.source, @@ -2728,7 +2736,7 @@ local default_rsyncssh = { ----- -- allow several processes -- - maxProcesses = 10, + maxProcesses = 1, ----- -- Default delay. diff --git a/tests/churn-rsync.lua b/tests/churn-rsync.lua index 9584b25..915588e 100755 --- a/tests/churn-rsync.lua +++ b/tests/churn-rsync.lua @@ -14,6 +14,9 @@ local trgdir = tdir.."trg/" posix.mkdir(srcdir) posix.mkdir(trgdir) +-- makes some startup data +churn(srcdir, 10) + local logs = {} --logs = {"-log", "Inotify", "-log", "Exec" } local pid = spawn("./lsyncd", "-nodaemon", diff --git a/tests/churn-rsyncssh.lua b/tests/churn-rsyncssh.lua index 9552d82..df417f5 100755 --- a/tests/churn-rsyncssh.lua +++ b/tests/churn-rsyncssh.lua @@ -14,9 +14,12 @@ local trgdir = tdir.."trg/" posix.mkdir(srcdir) posix.mkdir(trgdir) +-- makes some startup data +churn(srcdir, 10) + local logs = {} --logs = {"-log", "Inotify", "-log", "Exec" } ---logs = {"-log", "all" } +--logs = {"-log", "Delay"} local pid = spawn("./lsyncd", "-nodaemon", "-rsyncssh", srcdir, "localhost", trgdir,