lsyncd/examples/lbash.lua

48 lines
1.0 KiB
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.
--
-- This example uses local bash commands to keep two local
2010-11-13 07:53:04 +00:00
-- 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-29 16:38:31 +00:00
-- otherwise it deletes contents in the target if there.
onStartup = [[
if [ "$(ls -A ^source)" ]; then
cp -r ^source* ^target;
else
2010-11-29 16:38:31 +00:00
if [ "$(ls -A ^target)" ]; then rm -rf ^target/*; fi
fi]],
2010-10-22 10:35:26 +00:00
2010-11-29 16:37:46 +00:00
onCreate = prefix..[[cp -r ^sourcePath ^targetPathdir]],
2010-11-29 16:37:46 +00:00
onModify = prefix..[[cp -r ^sourcePath ^targetPathdir]],
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