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-17 15:24:55 +00:00
|
|
|
nodaemon,
|
2010-10-27 19:34:56 +00:00
|
|
|
statuspipe = "/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,
|
|
|
|
|
|
|
|
create = function(source, path, name, target)
|
|
|
|
local src = source..path..name
|
2010-10-23 12:36:55 +00:00
|
|
|
local trg = target..path..name
|
|
|
|
log(NORMAL, "create from "..src.." -> "..trg)
|
2010-10-27 11:31:18 +00:00
|
|
|
return shell(prefix..[[cp "$1" "$2"]], src, trg)
|
2010-10-23 12:36:55 +00:00
|
|
|
end,
|
|
|
|
|
|
|
|
modify = function(source, path, name, target)
|
|
|
|
local src = source..path..name
|
|
|
|
local trg = target..path..name
|
|
|
|
log(NORMAL, "modify from "..src.." -> "..trg)
|
2010-10-27 11:31:18 +00:00
|
|
|
return shell(prefix..[[cp "$1" "$2"]], src, trg)
|
2010-10-22 10:35:26 +00:00
|
|
|
end,
|
|
|
|
|
|
|
|
attrib = function(source, path, name, target)
|
|
|
|
-- ignore attribs
|
|
|
|
return 0
|
|
|
|
end,
|
|
|
|
|
|
|
|
delete = function(source, path, name, target)
|
2010-10-27 11:31:18 +00:00
|
|
|
local trg = target..path..name
|
|
|
|
log(NORMAL, "delete "..trg)
|
|
|
|
return exec(prefix..[[rm "$1"]], trg)
|
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
|
|
|
|