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-11-02 21:04:01 +00:00
|
|
|
-- nodaemon = true,
|
2010-10-28 17:56:33 +00:00
|
|
|
statusfile = "/tmp/lsyncd.stat",
|
2010-10-16 18:21:01 +00:00
|
|
|
}
|
|
|
|
|
2010-10-22 10:35:26 +00:00
|
|
|
------
|
2010-11-01 16:38:39 +00:00
|
|
|
-- for testing purposes. uses bash command to hold local dirs in sync.
|
2010-10-22 10:35:26 +00:00
|
|
|
--
|
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)
|
2010-11-02 21:04:01 +00:00
|
|
|
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 19:57:53 +00:00
|
|
|
create = function(event)
|
2010-11-02 21:04:01 +00:00
|
|
|
log("Normal", "create from "..event.spath.." -> "..event.tpath)
|
2010-11-01 14:16:35 +00:00
|
|
|
return shell(prefix..[[cp "$1" "$2"]], event.spath, event.tpath)
|
2010-10-23 12:36:55 +00:00
|
|
|
end,
|
|
|
|
|
2010-11-01 19:57:53 +00:00
|
|
|
modify = function(event)
|
2010-11-02 21:04:01 +00:00
|
|
|
log("Normal", "modify from "..event.spath.." -> "..event.tpath)
|
2010-11-01 14:16:35 +00:00
|
|
|
return shell(prefix..[[cp "$1" "$2"]], event.spath, event.tpath)
|
2010-10-22 10:35:26 +00:00
|
|
|
end,
|
|
|
|
|
2010-11-01 19:57:53 +00:00
|
|
|
attrib = function(event)
|
2010-10-22 10:35:26 +00:00
|
|
|
-- ignore attribs
|
|
|
|
return 0
|
|
|
|
end,
|
|
|
|
|
2010-11-01 19:57:53 +00:00
|
|
|
delete = function(event)
|
2010-11-02 21:04:01 +00:00
|
|
|
log("Normal", "delete "..event.tpath)
|
2010-11-01 14:16:35 +00:00
|
|
|
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-11-03 11:37:25 +00:00
|
|
|
sync{slowbash, source="s", target="d/"}
|
2010-10-16 18:21:01 +00:00
|
|
|
|