lsyncd/lsyncd-conf.lua

60 lines
1.4 KiB
Lua
Raw Normal View History

2010-10-19 10:20:27 +00:00
----
-- User configuration file for lsyncd.
--
-- TODO documentation-
--
2010-10-16 18:21:01 +00:00
settings = {
2010-10-22 10:35:26 +00:00
-- logfile = "/tmp/lsyncd",
2010-10-28 17:56:33 +00:00
-- nodaemon,
statusfile = "/tmp/lsyncd.stat",
2010-10-22 10:35:26 +00:00
loglevel = DEBUG,
2010-10-16 18:21:01 +00:00
}
2010-10-22 10:35:26 +00:00
------
-- for testing purposes
--
2010-10-27 11:31:18 +00:00
prefix = "sleep 1 && "
2010-10-22 10:35:26 +00:00
slowbash = {
2010-10-24 16:41:58 +00:00
delay = 5,
2010-10-22 10:35:26 +00:00
startup = function(source, target)
log(NORMAL, "cp -r from "..source.." -> "..target)
2010-10-27 11:31:18 +00:00
return shell([[if [ "$(ls -A $1)" ]; then cp -r "$1"* "$2"; fi]], source, target)
2010-10-22 10:35:26 +00:00
end,
2010-11-01 14:16:35 +00:00
create = function(self, unit)
local event = unit:nextevent()
log(NORMAL, "create from "..event.spath.." -> "..event.tpath)
return shell(prefix..[[cp "$1" "$2"]], event.spath, event.tpath)
2010-10-23 12:36:55 +00:00
end,
2010-11-01 14:16:35 +00:00
modify = function(self, unit)
local event = unit:nextevent()
log(NORMAL, "modify from "..event.spath.." -> "..event.tpath)
return shell(prefix..[[cp "$1" "$2"]], event.spath, event.tpath)
2010-10-22 10:35:26 +00:00
end,
2010-11-01 14:16:35 +00:00
attrib = function(self, unit)
2010-10-22 10:35:26 +00:00
-- ignore attribs
return 0
end,
2010-11-01 14:16:35 +00:00
delete = function(self, unit)
local event = unit:nextevent()
log(NORMAL, "delete "..event.tpath)
return exec(prefix..[[rm "$1"]], event.tpath)
2010-10-22 10:35:26 +00:00
end,
2010-10-27 09:41:14 +00:00
-- move = function(source, path, name, destpath, destname, target)
-- log(NORMAL, "move from " .. destination .. "/" .. path)
2010-10-23 12:36:55 +00:00
-- return exec("/bin/bash", "-c", "sleep " .. slowsec .. " && rm $1 $2", "/bin/bash",
-- source .. "/" .. path, target .. "/" .. path)
2010-10-27 09:41:14 +00:00
-- return 0
-- end,
2010-10-22 10:35:26 +00:00
}
2010-10-22 08:34:41 +00:00
2010-10-23 12:36:55 +00:00
sync("s", "d/", slowbash)
2010-10-16 18:21:01 +00:00
2010-10-17 17:13:53 +00:00