mirror of
https://github.com/octoleo/lsyncd.git
synced 2025-01-07 09:04:05 +00:00
finished new -direct option
This commit is contained in:
parent
79e182cefe
commit
cbe9d5c03b
25
lsyncd.lua
25
lsyncd.lua
@ -3436,13 +3436,30 @@ local default_direct = {
|
||||
-- gets all events ready for syncing
|
||||
local event, event2 = inlet.getEvent()
|
||||
|
||||
if event.etype == "Create" or event.etype == "Modifiy" then
|
||||
if event.etype == "Create" then
|
||||
if event.isdir then
|
||||
spawn(event,
|
||||
"/bin/mkdir",
|
||||
"-p",
|
||||
event.targetPath
|
||||
)
|
||||
else
|
||||
spawn(event,
|
||||
"/bin/cp",
|
||||
"-t",
|
||||
event.targetPathdir,
|
||||
event.sourcePath
|
||||
)
|
||||
end
|
||||
elseif event.etype == "Modify" then
|
||||
if event.isdir then
|
||||
error("Do not know how to handle 'Modify' on dirs")
|
||||
end
|
||||
spawn(event,
|
||||
"/bin/cp",
|
||||
"-p",
|
||||
event.sourcePath,
|
||||
"-t",
|
||||
event.targetPathdir
|
||||
event.targetPathdir,
|
||||
event.sourcePath
|
||||
)
|
||||
elseif event.etype == "Delete" then
|
||||
local tp = event.targetPath
|
||||
|
@ -13,7 +13,7 @@ local tdir, srcdir, trgdir = mktemps()
|
||||
-- makes some startup data
|
||||
churn(srcdir, 10)
|
||||
|
||||
local logs = {}
|
||||
local logs = {"-log", "Exec"}
|
||||
--logs = {"-log", "Delay", "-log", "Fsevents" }
|
||||
local pid = spawn("./lsyncd", "-nodaemon",
|
||||
"-direct", srcdir, trgdir, unpack(logs))
|
||||
|
Loading…
Reference in New Issue
Block a user