2010-10-19 10:20:27 +00:00
|
|
|
----
|
|
|
|
-- User configuration file for lsyncd.
|
2010-11-13 07:53:04 +00:00
|
|
|
--
|
|
|
|
-- This example uses local bash commands to keep two local
|
|
|
|
-- directory trees in sync.
|
2010-10-19 10:20:27 +00:00
|
|
|
--
|
2010-10-16 18:21:01 +00:00
|
|
|
settings = {
|
2010-11-12 11:04:45 +00:00
|
|
|
statusFile = "/tmp/lsyncd.stat",
|
|
|
|
statusIntervall = 1,
|
2010-10-16 18:21:01 +00:00
|
|
|
}
|
|
|
|
|
2010-11-13 08:00:07 +00:00
|
|
|
----
|
|
|
|
-- for testing purposes. prefix can be used to slow commands down.
|
|
|
|
-- prefix = "sleep 5 && "
|
|
|
|
prefix = ""
|
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-11-13 08:00:07 +00:00
|
|
|
bash = {
|
2010-10-24 16:41:58 +00:00
|
|
|
delay = 5,
|
|
|
|
|
2010-11-12 11:04:45 +00:00
|
|
|
maxProcesses = 3,
|
2010-11-12 09:45:22 +00:00
|
|
|
|
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-13 07:53:04 +00:00
|
|
|
onModify = function(event)
|
|
|
|
local s = event.sourcePathname
|
|
|
|
local t = event.targetPathname
|
|
|
|
log("Normal", "Spawning Modify ",s," -> ",t)
|
|
|
|
spawnShell(event, prefix..[[cp -r "$1" "$2"]], s, t)
|
|
|
|
end,
|
2010-10-22 10:35:26 +00:00
|
|
|
|
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-13 08:00:07 +00:00
|
|
|
sync{bash, source="src", target="dst/"}
|
2010-10-16 18:21:01 +00:00
|
|
|
|