This commit is contained in:
Axel Kittenberger 2010-11-11 18:34:44 +00:00
parent b072f58e9c
commit 455a9941fa
2 changed files with 8 additions and 13 deletions

View File

@ -28,27 +28,27 @@ slowbash = {
local s = event.sourcePathname
local t = event.targetPathname
log("Normal", "Spawning Create ", s," -> ",t)
spawnShell(event, "ok", prefix..[[cp -r "$1" "$2"]], 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, "ok", prefix..[[cp -r "$1" "$2"]], s, t)
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
end,
onDelete = function(event)
local t = event.targetPathname
log("Normal", "Spawning Delete of ",t)
spawnShell(event, "ok", prefix..[[rm -rf "$1"]], t)
spawnShell(event, prefix..[[rm -rf "$1"]], t)
end,
onMove = function(originEvent, destinationEvent)
local t = originEvent.targetPathname
local d = destinationEvent.targetPathname
log("Normal", "Spawning Move from ",t," to ",d)
spawnShell(event, "ok", prefix..[[mv "$1" "$2"]], t, d)
spawnShell(originEvent, prefix..[[mv "$1" "$2"]], t, d)
end,
}

View File

@ -863,6 +863,7 @@ local Syncs = (function()
return {add = add, iwalk = iwalk, size = size}
end)()
-----
-- Interface to inotify, watches recursively subdirs and
-- sends events.
@ -930,7 +931,7 @@ local Inotifies = (function()
-----
-- Removes one event receiver from a directory.
--
function removeSync(sync, path)
local function removeSync(sync, path)
local sp = syncpaths[sync]
if not sp then
error("internal fail, removeSync, nonexisting sync: ")
@ -972,7 +973,7 @@ local Inotifies = (function()
-- @param filename string filename without path
-- @param filename2
--
function event(etype, wd, isdir, time, filename, filename2)
local function event(etype, wd, isdir, time, filename, filename2)
local ftype;
if isdir then
ftype = "directory"
@ -1180,7 +1181,6 @@ function runner.cycle(now)
end
end
-----
-- Called by core before anything is "-help" or "--help" is in
-- the arguments.
@ -1268,7 +1268,6 @@ function runner.initialize()
-- From this point on, no globals may be created anymore
lockGlobals()
print(_G.event)
-----
-- transfers some defaults to settings
@ -1397,9 +1396,6 @@ function spawn(agent, binary, ...)
if agent == nil then
error("spawning with a nil agent", 2)
end
print(agent)
print(event)
print(_G.event)
local pid = lsyncd.exec(binary, ...)
if pid and pid > 0 then
local sync, delay = InletControl.getInterior(agent)
@ -1532,7 +1528,7 @@ default = {
return
end
log("Normal", "Finished ",event.etype,
" on ",event.sourcename," = ",exitcode)
" on ",event.sourcePath," = ",exitcode)
end,
-----
@ -1574,5 +1570,4 @@ default = {
-----
-- Returns the core the runners function interface.
--
print("EVENT ", _G.event)
return runner