mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-05 16:12:32 +00:00
This commit is contained in:
parent
c84308b973
commit
60a14c262f
@ -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
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/"}
|
||||
|
18
lsyncd.lua
18
lsyncd.lua
@ -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 ",
|
||||
|
Loading…
Reference in New Issue
Block a user