This commit is contained in:
Axel Kittenberger 2010-11-13 07:53:04 +00:00
parent c84308b973
commit 60a14c262f
3 changed files with 36 additions and 19 deletions

View File

@ -1,11 +1,10 @@
----
-- User configuration file for lsyncd.
--
-- TODO documentation-
--
-- This example uses local bash commands to keep two local
-- directory trees in sync.
--
settings = {
-- logfile = "/tmp/lsyncd",
-- nodaemon = true,
statusFile = "/tmp/lsyncd.stat",
statusIntervall = 1,
}
@ -26,10 +25,6 @@ slowbash = {
event.source, event.target)
end,
onModify = function(event)
spawn(event, "/home/axel/lsyncd2/in", "<", "tuhutu\n", "2")
end,
onCreate = function(event)
local s = event.sourcePathname
local t = event.targetPathname
@ -37,12 +32,12 @@ slowbash = {
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
end,
-- onModify = function(event)
-- local s = event.sourcePathname
-- local t = event.targetPathname
-- log("Normal", "Spawning Modify ",s," -> ",t)
-- spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
-- end,
onModify = function(event)
local s = event.sourcePathname
local t = event.targetPathname
log("Normal", "Spawning Modify ",s," -> ",t)
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
end,
onDelete = function(event)
local t = event.targetPathname
@ -58,5 +53,5 @@ slowbash = {
end,
}
sync{default.rsync, source="s", target="d/"}
sync{default.rsync, source="src", target="dst/"}

12
examples/lrsync.lua Normal file
View File

@ -0,0 +1,12 @@
----
-- User configuration file for lsyncd.
--
-- Simple example for default rsync.
--
settings = {
statusFile = "/tmp/lsyncd.stat",
statusIntervall = 1,
}
sync{default.rsync, source="src", target="dst/"}

View File

@ -798,10 +798,20 @@ local Sync = (function()
od.etype," on ",path)
return
elseif c == 2 then
log("Delay",nd.etype," replaces event ",
od.etype," on ",path)
self.delays[il] = nd
-- TODO turn moveFroms into deletes.
if od.etype ~= "Move" then
log("Delay",nd.etype," replaces event ",
od.etype," on ",path)
od.etype = nd.etype
if od.path ~= nd.path then
error("Cannot replace events with different paths")
end
else
log("Delay",nd.etype," turns a move into delete ",
od.etype," on ", path)
od.etype = "Delete"
od.path2 = nil
table.insert(self.delays, nd)
end
return
elseif c == 3 then
log("Delay", "Stacking ",nd.etype," upon ",