lsyncd/examples/lbash.lua
2010-11-26 12:52:05 +00:00

43 lines
939 B
Lua

-----
-- User configuration file for lsyncd.
--
-- This example uses local bash commands to keep two local
-- directory trees in sync.
--
settings = {
logfile = "/tmp/lsyncd.log",
statusFile = "/tmp/lsyncd.stat",
statusIntervall = 1,
nodaemon = true,
}
-----
-- for testing purposes. prefix can be used to slow commands down.
-- prefix = "sleep 5 && "
--
prefix = ""
-----
-- for testing purposes. uses bash command to hold local dirs in sync.
--
bash = {
delay = 0,
maxProcesses = 1,
-- calls `cp -r SOURCE/* TARGET` only when there is something in SOURCE
onStartup =
[[if [ "$(ls -A ^source)" ]; then cp -r ^source* ^target; fi]],
onCreate = prefix..[[cp -r ^sourcePath ^targetPath]],
onModify = prefix..[[cp -r ^sourcePath ^targetPath]],
onDelete = prefix..[[rm -rf ^targetPath]],
onMove = prefix..[[mv ^o.targetPath ^d.targetPath]],
}
sync{bash, source="src", target="/path/to/trg/"}