lsyncd/lsyncd-conf.lua

57 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-11-02 21:04:01 +00:00
-- nodaemon = true,
2010-10-28 17:56:33 +00:00
statusfile = "/tmp/lsyncd.stat",
2010-11-09 19:15:41 +00:00
statusintervall = 1,
2010-10-16 18:21:01 +00:00
}
2010-11-05 18:20:33 +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-11-11 09:36:56 +00:00
onStartup = function(event)
2010-11-11 15:17:22 +00:00
log("Normal", "cp -r from ", event.source, " -> ", event.target)
2010-11-11 09:36:56 +00:00
spawnShell(event,
2010-11-07 01:06:08 +00:00
[[if [ "$(ls -A $1)" ]; then cp -r "$1"* "$2"; fi]],
2010-11-11 15:17:22 +00:00
event.source, event.target)
2010-10-22 10:35:26 +00:00
end,
2010-11-06 17:40:12 +00:00
onCreate = function(event)
local s = event.sourcePathname
local t = event.targetPathname
2010-11-10 11:23:26 +00:00
log("Normal", "Spawning Create ", s," -> ",t)
2010-11-11 18:34:44 +00:00
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
2010-10-23 12:36:55 +00:00
end,
2010-11-06 17:40:12 +00:00
onModify = function(event)
local s = event.sourcePathname
local t = event.targetPathname
2010-11-10 11:23:26 +00:00
log("Normal", "Spawning Modify ",s," -> ",t)
2010-11-11 18:34:44 +00:00
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
2010-10-22 10:35:26 +00:00
end,
2010-11-06 17:40:12 +00:00
onDelete = function(event)
local t = event.targetPathname
2010-11-10 11:23:26 +00:00
log("Normal", "Spawning Delete of ",t)
2010-11-11 18:34:44 +00:00
spawnShell(event, prefix..[[rm -rf "$1"]], t)
2010-11-06 17:40:12 +00:00
end,
2010-11-11 09:36:56 +00:00
onMove = function(originEvent, destinationEvent)
local t = originEvent.targetPathname
local d = destinationEvent.targetPathname
2010-11-10 11:23:26 +00:00
log("Normal", "Spawning Move from ",t," to ",d)
2010-11-11 18:34:44 +00:00
spawnShell(originEvent, prefix..[[mv "$1" "$2"]], t, d)
2010-10-22 10:35:26 +00:00
end,
}
2010-11-03 11:37:25 +00:00
sync{slowbash, source="s", target="d/"}
2010-10-16 18:21:01 +00:00