lsyncd/examples/lbash.lua

43 lines
939 B
Lua
Raw Normal View History

2010-11-14 09:11:09 +00:00
-----
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-14 09:11:09 +00:00
logfile = "/tmp/lsyncd.log",
statusFile = "/tmp/lsyncd.stat",
2010-11-12 11:04:45 +00:00
statusIntervall = 1,
2010-11-14 09:11:09 +00:00
nodaemon = true,
2010-10-16 18:21:01 +00:00
}
2010-11-14 09:11:09 +00:00
-----
2010-11-13 08:00:07 +00:00
-- for testing purposes. prefix can be used to slow commands down.
-- prefix = "sleep 5 && "
2010-11-14 09:11:09 +00:00
--
2010-11-13 08:00:07 +00:00
prefix = ""
2010-11-14 09:11:09 +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 = {
delay = 0,
2010-10-24 16:41:58 +00:00
maxProcesses = 1,
2010-11-12 09:45:22 +00:00
-- calls `cp -r SOURCE/* TARGET` only when there is something in SOURCE
2010-11-13 13:44:51 +00:00
onStartup =
2010-11-14 16:03:47 +00:00
[[if [ "$(ls -A ^source)" ]; then cp -r ^source* ^target; fi]],
2010-10-22 10:35:26 +00:00
onCreate = prefix..[[cp -r ^sourcePath ^targetPath]],
2010-11-13 13:44:51 +00:00
onModify = prefix..[[cp -r ^sourcePath ^targetPath]],
2010-11-13 13:44:51 +00:00
onDelete = prefix..[[rm -rf ^targetPath]],
2010-10-23 12:36:55 +00:00
onMove = prefix..[[mv ^o.targetPath ^d.targetPath]],
2010-10-22 10:35:26 +00:00
}
2010-11-17 18:52:55 +00:00
sync{bash, source="src", target="/path/to/trg/"}
2010-10-16 18:21:01 +00:00