mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-23 07:08:33 +00:00
This commit is contained in:
parent
c84308b973
commit
60a14c262f
@ -1,11 +1,10 @@
|
|||||||
----
|
----
|
||||||
-- User configuration file for lsyncd.
|
-- User configuration file for lsyncd.
|
||||||
--
|
--
|
||||||
-- TODO documentation-
|
-- This example uses local bash commands to keep two local
|
||||||
|
-- directory trees in sync.
|
||||||
--
|
--
|
||||||
settings = {
|
settings = {
|
||||||
-- logfile = "/tmp/lsyncd",
|
|
||||||
-- nodaemon = true,
|
|
||||||
statusFile = "/tmp/lsyncd.stat",
|
statusFile = "/tmp/lsyncd.stat",
|
||||||
statusIntervall = 1,
|
statusIntervall = 1,
|
||||||
}
|
}
|
||||||
@ -26,10 +25,6 @@ slowbash = {
|
|||||||
event.source, event.target)
|
event.source, event.target)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
onModify = function(event)
|
|
||||||
spawn(event, "/home/axel/lsyncd2/in", "<", "tuhutu\n", "2")
|
|
||||||
end,
|
|
||||||
|
|
||||||
onCreate = function(event)
|
onCreate = function(event)
|
||||||
local s = event.sourcePathname
|
local s = event.sourcePathname
|
||||||
local t = event.targetPathname
|
local t = event.targetPathname
|
||||||
@ -37,12 +32,12 @@ slowbash = {
|
|||||||
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
|
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-- onModify = function(event)
|
onModify = function(event)
|
||||||
-- local s = event.sourcePathname
|
local s = event.sourcePathname
|
||||||
-- local t = event.targetPathname
|
local t = event.targetPathname
|
||||||
-- log("Normal", "Spawning Modify ",s," -> ",t)
|
log("Normal", "Spawning Modify ",s," -> ",t)
|
||||||
-- spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
|
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
|
||||||
-- end,
|
end,
|
||||||
|
|
||||||
onDelete = function(event)
|
onDelete = function(event)
|
||||||
local t = event.targetPathname
|
local t = event.targetPathname
|
||||||
@ -58,5 +53,5 @@ slowbash = {
|
|||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
|
||||||
sync{default.rsync, source="s", target="d/"}
|
sync{default.rsync, source="src", target="dst/"}
|
||||||
|
|
12
examples/lrsync.lua
Normal file
12
examples/lrsync.lua
Normal 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/"}
|
||||||
|
|
14
lsyncd.lua
14
lsyncd.lua
@ -798,10 +798,20 @@ local Sync = (function()
|
|||||||
od.etype," on ",path)
|
od.etype," on ",path)
|
||||||
return
|
return
|
||||||
elseif c == 2 then
|
elseif c == 2 then
|
||||||
|
if od.etype ~= "Move" then
|
||||||
log("Delay",nd.etype," replaces event ",
|
log("Delay",nd.etype," replaces event ",
|
||||||
od.etype," on ",path)
|
od.etype," on ",path)
|
||||||
self.delays[il] = nd
|
od.etype = nd.etype
|
||||||
-- TODO turn moveFroms into deletes.
|
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
|
return
|
||||||
elseif c == 3 then
|
elseif c == 3 then
|
||||||
log("Delay", "Stacking ",nd.etype," upon ",
|
log("Delay", "Stacking ",nd.etype," upon ",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user