2010-11-14 09:11:09 +00:00
|
|
|
-----
|
2010-10-19 10:20:27 +00:00
|
|
|
-- User configuration file for lsyncd.
|
2012-09-07 06:58:44 +00:00
|
|
|
--
|
|
|
|
-- 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
|
|
|
--
|
2016-08-31 15:46:38 +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
|
|
|
--
|
2022-11-11 14:27:21 +00:00
|
|
|
local 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
|
|
|
--
|
2022-11-11 14:27:21 +00:00
|
|
|
local bash = {
|
2010-11-26 12:52:05 +00:00
|
|
|
delay = 0,
|
2010-10-24 16:41:58 +00:00
|
|
|
|
2010-11-26 12:52:05 +00:00
|
|
|
maxProcesses = 1,
|
2010-11-12 09:45:22 +00:00
|
|
|
|
2010-11-26 12:52:05 +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 = [[
|
2012-09-07 06:58:44 +00:00
|
|
|
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]],
|
2012-09-07 06:58:44 +00:00
|
|
|
|
2010-11-29 16:37:46 +00:00
|
|
|
onModify = prefix..[[cp -r ^sourcePath ^targetPathdir]],
|
2012-09-07 06:58:44 +00:00
|
|
|
|
2010-11-26 12:52:05 +00:00
|
|
|
onDelete = prefix..[[rm -rf ^targetPath]],
|
2010-10-23 12:36:55 +00:00
|
|
|
|
2010-11-26 12:52:05 +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
|
|
|
|