mirror of https://github.com/octoleo/lsyncd.git
removed extra spaces
This commit is contained in:
parent
e252496a4e
commit
b762b6f608
172
lsyncd.lua
172
lsyncd.lua
|
@ -2747,10 +2747,10 @@ function runner.initialize(firstTime)
|
||||||
-- all command line settings overwrite config file settings
|
-- all command line settings overwrite config file settings
|
||||||
for k, v in pairs(clSettings) do
|
for k, v in pairs(clSettings) do
|
||||||
if k ~= 'syncs' then
|
if k ~= 'syncs' then
|
||||||
settings[k]=v
|
settings[k]=v
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- implicitly force insist to be true on Lsyncd resets.
|
-- implicitly force insist to be true on Lsyncd resets.
|
||||||
if not firstTime then
|
if not firstTime then
|
||||||
settings.insist = true
|
settings.insist = true
|
||||||
|
@ -2850,7 +2850,7 @@ function runner.getAlarm()
|
||||||
----
|
----
|
||||||
-- checks if current nearest alarm or a is earlier
|
-- checks if current nearest alarm or a is earlier
|
||||||
--
|
--
|
||||||
local function checkAlarm(a)
|
local function checkAlarm(a)
|
||||||
if a == nil then
|
if a == nil then
|
||||||
error('got nil alarm')
|
error('got nil alarm')
|
||||||
end
|
end
|
||||||
|
@ -2896,7 +2896,7 @@ runner.fsEventsEvent = Fsevents.event
|
||||||
--
|
--
|
||||||
-- Parameters are pid and exitcode of child process
|
-- Parameters are pid and exitcode of child process
|
||||||
--
|
--
|
||||||
-- Can return either a new pid if one other child process
|
-- Can return either a new pid if one other child process
|
||||||
-- has been spawned as replacement (e.g. retry) or 0 if
|
-- has been spawned as replacement (e.g. retry) or 0 if
|
||||||
-- finished/ok.
|
-- finished/ok.
|
||||||
--
|
--
|
||||||
|
@ -2999,7 +2999,7 @@ function spawn(agent, binary, ...)
|
||||||
-- is a delay
|
-- is a delay
|
||||||
dol.status = 'active'
|
dol.status = 'active'
|
||||||
sync.processes[pid] = dol
|
sync.processes[pid] = dol
|
||||||
else
|
else
|
||||||
-- is a list
|
-- is a list
|
||||||
for _, d in ipairs(dol) do
|
for _, d in ipairs(dol) do
|
||||||
d.status = 'active'
|
d.status = 'active'
|
||||||
|
@ -3069,14 +3069,14 @@ local rsync_exitcodes = {
|
||||||
[ 4] = 'die',
|
[ 4] = 'die',
|
||||||
[ 5] = 'again',
|
[ 5] = 'again',
|
||||||
[ 6] = 'again',
|
[ 6] = 'again',
|
||||||
[ 10] = 'again',
|
[ 10] = 'again',
|
||||||
[ 11] = 'again',
|
[ 11] = 'again',
|
||||||
[ 12] = 'again',
|
[ 12] = 'again',
|
||||||
[ 14] = 'again',
|
[ 14] = 'again',
|
||||||
[ 20] = 'again',
|
[ 20] = 'again',
|
||||||
[ 21] = 'again',
|
[ 21] = 'again',
|
||||||
[ 22] = 'again',
|
[ 22] = 'again',
|
||||||
[ 23] = 'ok', -- partial transfers are ok, since Lsyncd has registered the event that
|
[ 23] = 'ok', -- partial transfers are ok, since Lsyncd has registered the event that
|
||||||
[ 24] = 'ok', -- caused the transfer to be partial and will recall rsync.
|
[ 24] = 'ok', -- caused the transfer to be partial and will recall rsync.
|
||||||
[ 25] = 'die',
|
[ 25] = 'die',
|
||||||
[ 30] = 'again',
|
[ 30] = 'again',
|
||||||
|
@ -3099,20 +3099,20 @@ local default_rsync = {
|
||||||
-----
|
-----
|
||||||
-- Spawns rsync for a list of events
|
-- Spawns rsync for a list of events
|
||||||
--
|
--
|
||||||
action = function(inlet)
|
action = function(inlet)
|
||||||
-- gets all events ready for syncing
|
-- gets all events ready for syncing
|
||||||
local elist = inlet.getEvents(
|
local elist = inlet.getEvents(
|
||||||
function(event)
|
function(event)
|
||||||
return event.etype ~= 'Init' and event.etype ~= 'Blanket'
|
return event.etype ~= 'Init' and event.etype ~= 'Blanket'
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- replaces filter rule by literals
|
-- replaces filter rule by literals
|
||||||
--
|
--
|
||||||
local function sub(p)
|
local function sub(p)
|
||||||
if not p then
|
if not p then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
return p:gsub('%?', '\\?'):
|
return p:gsub('%?', '\\?'):
|
||||||
gsub('%*', '\\*'):
|
gsub('%*', '\\*'):
|
||||||
|
@ -3121,24 +3121,24 @@ local default_rsync = {
|
||||||
end
|
end
|
||||||
|
|
||||||
local paths = elist.getPaths(
|
local paths = elist.getPaths(
|
||||||
function(etype, path1, path2)
|
function(etype, path1, path2)
|
||||||
if etype == 'Delete' and string.byte(path1, -1) == 47 then
|
if etype == 'Delete' and string.byte(path1, -1) == 47 then
|
||||||
return sub(path1)..'***', sub(path2)
|
return sub(path1)..'***', sub(path2)
|
||||||
else
|
else
|
||||||
return sub(path1), sub(path2)
|
return sub(path1), sub(path2)
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
-- stores all filters with integer index
|
-- stores all filters with integer index
|
||||||
-- local filterI = inlet.getExcludes();
|
-- local filterI = inlet.getExcludes();
|
||||||
local filterI = {}
|
local filterI = {}
|
||||||
-- stores all filters with path index
|
-- stores all filters with path index
|
||||||
local filterP = {}
|
local filterP = {}
|
||||||
|
|
||||||
-- adds one entry into the filter
|
-- adds one entry into the filter
|
||||||
-- @param path ... path to add
|
-- @param path ... path to add
|
||||||
-- @param leaf ... true if this the original path
|
-- @param leaf ... true if this the original path
|
||||||
-- false if its a parent
|
-- false if its a parent
|
||||||
local function addToFilter(path)
|
local function addToFilter(path)
|
||||||
if filterP[path] then
|
if filterP[path] then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -3148,7 +3148,7 @@ local default_rsync = {
|
||||||
|
|
||||||
-- adds a path to the filter, for rsync this needs
|
-- adds a path to the filter, for rsync this needs
|
||||||
-- to have entries for all steps in the path, so the file
|
-- to have entries for all steps in the path, so the file
|
||||||
-- d1/d2/d3/f1 needs filters
|
-- d1/d2/d3/f1 needs filters
|
||||||
-- 'd1/', 'd1/d2/', 'd1/d2/d3/' and 'd1/d2/d3/f1'
|
-- 'd1/', 'd1/d2/', 'd1/d2/d3/' and 'd1/d2/d3/f1'
|
||||||
for _, path in ipairs(paths) do
|
for _, path in ipairs(paths) do
|
||||||
if path and path ~= '' then
|
if path and path ~= '' then
|
||||||
|
@ -3160,12 +3160,12 @@ local default_rsync = {
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local filterS = table.concat(filterI, '\n')
|
local filterS = table.concat(filterI, '\n')
|
||||||
local filter0 = table.concat(filterI, '\000')
|
local filter0 = table.concat(filterI, '\000')
|
||||||
log('Normal', 'Calling rsync with filter-list of new/modified files/dirs\n', filterS)
|
log('Normal', 'Calling rsync with filter-list of new/modified files/dirs\n', filterS)
|
||||||
local config = inlet.getConfig()
|
local config = inlet.getConfig()
|
||||||
spawn(elist, config.rsyncBinary,
|
spawn(elist, config.rsyncBinary,
|
||||||
'<', filter0,
|
'<', filter0,
|
||||||
config.rsyncOpts,
|
config.rsyncOpts,
|
||||||
'-r',
|
'-r',
|
||||||
|
@ -3174,39 +3174,39 @@ local default_rsync = {
|
||||||
'--from0',
|
'--from0',
|
||||||
'--include-from=-',
|
'--include-from=-',
|
||||||
'--exclude=*',
|
'--exclude=*',
|
||||||
config.source,
|
config.source,
|
||||||
config.target)
|
config.target)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Spawns the recursive startup sync
|
-- Spawns the recursive startup sync
|
||||||
--
|
--
|
||||||
init = function(event)
|
init = function(event)
|
||||||
local config = event.config;
|
local config = event.config;
|
||||||
local inlet = event.inlet;
|
local inlet = event.inlet;
|
||||||
local excludes = inlet.getExcludes();
|
local excludes = inlet.getExcludes();
|
||||||
if #excludes == 0 then
|
if #excludes == 0 then
|
||||||
log('Normal', 'recursive startup rsync: ', config.source, ' -> ', config.target)
|
log('Normal', 'recursive startup rsync: ', config.source, ' -> ', config.target)
|
||||||
spawn(event, config.rsyncBinary,
|
spawn(event, config.rsyncBinary,
|
||||||
'--delete',
|
'--delete',
|
||||||
config.rsyncOpts,
|
config.rsyncOpts,
|
||||||
'-r',
|
'-r',
|
||||||
config.source,
|
config.source,
|
||||||
config.target)
|
config.target)
|
||||||
else
|
else
|
||||||
local exS = table.concat(excludes, '\n')
|
local exS = table.concat(excludes, '\n')
|
||||||
log('Normal', 'recursive startup rsync: ',config.source,
|
log('Normal', 'recursive startup rsync: ',config.source,
|
||||||
' -> ',config.target,' excluding\n',exS)
|
' -> ',config.target,' excluding\n',exS)
|
||||||
spawn(event, config.rsyncBinary,
|
spawn(event, config.rsyncBinary,
|
||||||
'<', exS,
|
'<', exS,
|
||||||
'--exclude-from=-',
|
'--exclude-from=-',
|
||||||
'--delete',
|
'--delete',
|
||||||
config.rsyncOpts, '-r',
|
config.rsyncOpts, '-r',
|
||||||
config.source,
|
config.source,
|
||||||
config.target)
|
config.target)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Checks the configuration.
|
-- Checks the configuration.
|
||||||
--
|
--
|
||||||
|
@ -3220,7 +3220,7 @@ local default_rsync = {
|
||||||
config.target = config.target..'/'
|
config.target = config.target..'/'
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- The rsync binary called.
|
-- The rsync binary called.
|
||||||
--
|
--
|
||||||
|
@ -3235,7 +3235,7 @@ local default_rsync = {
|
||||||
-- exit codes for rsync.
|
-- exit codes for rsync.
|
||||||
--
|
--
|
||||||
exitcodes = rsync_exitcodes,
|
exitcodes = rsync_exitcodes,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Default delay
|
-- Default delay
|
||||||
--
|
--
|
||||||
|
@ -3250,24 +3250,24 @@ local default_rsyncssh = {
|
||||||
-----
|
-----
|
||||||
-- Spawns rsync for a list of events
|
-- Spawns rsync for a list of events
|
||||||
--
|
--
|
||||||
action = function(inlet)
|
action = function(inlet)
|
||||||
local event, event2 = inlet.getEvent()
|
local event, event2 = inlet.getEvent()
|
||||||
local config = inlet.getConfig()
|
local config = inlet.getConfig()
|
||||||
|
|
||||||
-- makes move local on host
|
-- makes move local on host
|
||||||
-- if fails deletes the source...
|
-- if fails deletes the source...
|
||||||
if event.etype == 'Move' then
|
if event.etype == 'Move' then
|
||||||
log('Normal', 'Moving ',event.path,' -> ',event2.path)
|
log('Normal', 'Moving ',event.path,' -> ',event2.path)
|
||||||
spawn(event, '/usr/bin/ssh',
|
spawn(event, '/usr/bin/ssh',
|
||||||
config.host,
|
config.host,
|
||||||
'mv',
|
'mv',
|
||||||
'\"' .. config.targetdir .. event.path .. '\"',
|
'\"' .. config.targetdir .. event.path .. '\"',
|
||||||
'\"' .. config.targetdir .. event2.path .. '\"',
|
'\"' .. config.targetdir .. event2.path .. '\"',
|
||||||
'||', 'rm', '-rf',
|
'||', 'rm', '-rf',
|
||||||
'\"' .. config.targetdir .. event.path .. '\"')
|
'\"' .. config.targetdir .. event.path .. '\"')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
-- uses ssh to delete files on remote host
|
-- uses ssh to delete files on remote host
|
||||||
-- instead of constructing rsync filters
|
-- instead of constructing rsync filters
|
||||||
if event.etype == 'Delete' then
|
if event.etype == 'Delete' then
|
||||||
|
@ -3277,7 +3277,7 @@ local default_rsyncssh = {
|
||||||
end)
|
end)
|
||||||
|
|
||||||
local paths = elist.getPaths(
|
local paths = elist.getPaths(
|
||||||
function(etype, path1, path2)
|
function(etype, path1, path2)
|
||||||
if path2 then
|
if path2 then
|
||||||
return config.targetdir..path1, config.targetdir..path2
|
return config.targetdir..path1, config.targetdir..path2
|
||||||
else
|
else
|
||||||
|
@ -3295,9 +3295,9 @@ local default_rsyncssh = {
|
||||||
local sPaths = table.concat(paths, '\n')
|
local sPaths = table.concat(paths, '\n')
|
||||||
local zPaths = table.concat(paths, config.xargs.delimiter)
|
local zPaths = table.concat(paths, config.xargs.delimiter)
|
||||||
log('Normal', 'Deleting list\n', sPaths)
|
log('Normal', 'Deleting list\n', sPaths)
|
||||||
spawn(elist, '/usr/bin/ssh',
|
spawn(elist, '/usr/bin/ssh',
|
||||||
'<', zPaths,
|
'<', zPaths,
|
||||||
config.host,
|
config.host,
|
||||||
config.xargs.binary, config.xargs.xparams)
|
config.xargs.binary, config.xargs.xparams)
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
@ -3306,33 +3306,33 @@ local default_rsyncssh = {
|
||||||
local elist = inlet.getEvents(
|
local elist = inlet.getEvents(
|
||||||
function(e)
|
function(e)
|
||||||
-- TODO use a table
|
-- TODO use a table
|
||||||
return e.etype ~= 'Move' and
|
return e.etype ~= 'Move' and
|
||||||
e.etype ~= 'Delete' and
|
e.etype ~= 'Delete' and
|
||||||
e.etype ~= 'Init' and
|
e.etype ~= 'Init' and
|
||||||
e.etype ~= 'Blanket'
|
e.etype ~= 'Blanket'
|
||||||
end)
|
end)
|
||||||
local paths = elist.getPaths()
|
local paths = elist.getPaths()
|
||||||
|
|
||||||
-- removes trailing slashes from dirs.
|
-- removes trailing slashes from dirs.
|
||||||
for k, v in ipairs(paths) do
|
for k, v in ipairs(paths) do
|
||||||
if string.byte(v, -1) == 47 then
|
if string.byte(v, -1) == 47 then
|
||||||
paths[k] = string.sub(v, 1, -2)
|
paths[k] = string.sub(v, 1, -2)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local sPaths = table.concat(paths, '\n')
|
local sPaths = table.concat(paths, '\n')
|
||||||
local zPaths = table.concat(paths, '\000')
|
local zPaths = table.concat(paths, '\000')
|
||||||
log('Normal', 'Rsyncing list\n', sPaths)
|
log('Normal', 'Rsyncing list\n', sPaths)
|
||||||
spawn(
|
spawn(
|
||||||
elist, config.rsyncBinary,
|
elist, config.rsyncBinary,
|
||||||
'<', zPaths,
|
'<', zPaths,
|
||||||
config.rsyncOpts,
|
config.rsyncOpts,
|
||||||
'--from0',
|
'--from0',
|
||||||
'--files-from=-',
|
'--files-from=-',
|
||||||
config.source,
|
config.source,
|
||||||
config.host .. ':' .. config.targetdir
|
config.host .. ':' .. config.targetdir
|
||||||
)
|
)
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Called when collecting a finished child process
|
-- Called when collecting a finished child process
|
||||||
--
|
--
|
||||||
|
@ -3359,7 +3359,7 @@ local default_rsyncssh = {
|
||||||
end
|
end
|
||||||
|
|
||||||
if agent.isList then
|
if agent.isList then
|
||||||
local rc = rsync_exitcodes[exitcode]
|
local rc = rsync_exitcodes[exitcode]
|
||||||
if rc == 'ok' then log('Normal', 'Finished (list): ',exitcode)
|
if rc == 'ok' then log('Normal', 'Finished (list): ',exitcode)
|
||||||
elseif rc == 'again' then log('Normal', 'Retrying (list): ',exitcode)
|
elseif rc == 'again' then log('Normal', 'Retrying (list): ',exitcode)
|
||||||
elseif rc == 'die' then log('Error', 'Failure (list): ', exitcode)
|
elseif rc == 'die' then log('Error', 'Failure (list): ', exitcode)
|
||||||
|
@ -3369,7 +3369,7 @@ local default_rsyncssh = {
|
||||||
end
|
end
|
||||||
return rc
|
return rc
|
||||||
else
|
else
|
||||||
local rc = ssh_exitcodes[exitcode]
|
local rc = ssh_exitcodes[exitcode]
|
||||||
if rc == 'ok' then
|
if rc == 'ok' then
|
||||||
log('Normal', 'Finished ',agent.etype,' ',agent.sourcePath,': ',exitcode)
|
log('Normal', 'Finished ',agent.etype,' ',agent.sourcePath,': ',exitcode)
|
||||||
elseif rc == 'again' then
|
elseif rc == 'again' then
|
||||||
|
@ -3386,7 +3386,7 @@ local default_rsyncssh = {
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Spawns the recursive startup sync
|
-- Spawns the recursive startup sync
|
||||||
--
|
--
|
||||||
init = function(event)
|
init = function(event)
|
||||||
local config = event.config
|
local config = event.config
|
||||||
local inlet = event.inlet
|
local inlet = event.inlet
|
||||||
|
@ -3396,11 +3396,11 @@ local default_rsyncssh = {
|
||||||
if #excludes == 0 then
|
if #excludes == 0 then
|
||||||
log('Normal', 'Recursive startup rsync: ',config.source,' -> ',target)
|
log('Normal', 'Recursive startup rsync: ',config.source,' -> ',target)
|
||||||
spawn(
|
spawn(
|
||||||
event, config.rsyncBinary,
|
event, config.rsyncBinary,
|
||||||
'--delete',
|
'--delete',
|
||||||
'-r',
|
'-r',
|
||||||
config.rsyncOpts,
|
config.rsyncOpts,
|
||||||
config.source,
|
config.source,
|
||||||
target
|
target
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
|
@ -3408,13 +3408,13 @@ local default_rsyncssh = {
|
||||||
log('Normal', 'Recursive startup rsync: ',config.source,
|
log('Normal', 'Recursive startup rsync: ',config.source,
|
||||||
' -> ',target,' with excludes.')
|
' -> ',target,' with excludes.')
|
||||||
spawn(
|
spawn(
|
||||||
event, config.rsyncBinary,
|
event, config.rsyncBinary,
|
||||||
'<', exS,
|
'<', exS,
|
||||||
'--exclude-from=-',
|
'--exclude-from=-',
|
||||||
'--delete',
|
'--delete',
|
||||||
'-r',
|
'-r',
|
||||||
config.rsyncOpts,
|
config.rsyncOpts,
|
||||||
config.source,
|
config.source,
|
||||||
target
|
target
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
@ -3432,7 +3432,7 @@ local default_rsyncssh = {
|
||||||
config.targetdir = config.targetdir .. '/'
|
config.targetdir = config.targetdir .. '/'
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- The rsync binary called.
|
-- The rsync binary called.
|
||||||
--
|
--
|
||||||
|
@ -3447,20 +3447,20 @@ local default_rsyncssh = {
|
||||||
-- allow processes
|
-- allow processes
|
||||||
--
|
--
|
||||||
maxProcesses = 1,
|
maxProcesses = 1,
|
||||||
|
|
||||||
------
|
------
|
||||||
-- Let the core not split move events.
|
-- Let the core not split move events.
|
||||||
--
|
--
|
||||||
onMove = true,
|
onMove = true,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Default delay.
|
-- Default delay.
|
||||||
--
|
--
|
||||||
delay = 15,
|
delay = 15,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Delimiter, the binary and the paramters passed to xargs
|
-- Delimiter, the binary and the paramters passed to xargs
|
||||||
-- xargs is used to delete multiple remote files, when ssh access is
|
-- xargs is used to delete multiple remote files, when ssh access is
|
||||||
-- available this is simpler than to build filters for rsync for this.
|
-- available this is simpler than to build filters for rsync for this.
|
||||||
-- Default uses '0' as limiter, you might override this for old systems.
|
-- Default uses '0' as limiter, you might override this for old systems.
|
||||||
--
|
--
|
||||||
|
@ -3479,7 +3479,7 @@ local default_direct = {
|
||||||
-----
|
-----
|
||||||
-- Spawns rsync for a list of events
|
-- Spawns rsync for a list of events
|
||||||
--
|
--
|
||||||
action = function(inlet)
|
action = function(inlet)
|
||||||
-- gets all events ready for syncing
|
-- gets all events ready for syncing
|
||||||
local event, event2 = inlet.getEvent()
|
local event, event2 = inlet.getEvent()
|
||||||
|
|
||||||
|
@ -3493,22 +3493,22 @@ local default_direct = {
|
||||||
)
|
)
|
||||||
else
|
else
|
||||||
spawn(
|
spawn(
|
||||||
event,
|
event,
|
||||||
'/bin/cp',
|
'/bin/cp',
|
||||||
'-t',
|
'-t',
|
||||||
event.targetPathdir,
|
event.targetPathdir,
|
||||||
event.sourcePath
|
event.sourcePath
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
elseif event.etype == 'Modify' then
|
elseif event.etype == 'Modify' then
|
||||||
if event.isdir then
|
if event.isdir then
|
||||||
error("Do not know how to handle 'Modify' on dirs")
|
error("Do not know how to handle 'Modify' on dirs")
|
||||||
end
|
end
|
||||||
spawn(event,
|
spawn(event,
|
||||||
'/bin/cp',
|
'/bin/cp',
|
||||||
'-t',
|
'-t',
|
||||||
event.targetPathdir,
|
event.targetPathdir,
|
||||||
event.sourcePath
|
event.sourcePath
|
||||||
)
|
)
|
||||||
elseif event.etype == 'Delete' then
|
elseif event.etype == 'Delete' then
|
||||||
local tp = event.targetPath
|
local tp = event.targetPath
|
||||||
|
@ -3533,13 +3533,13 @@ local default_direct = {
|
||||||
inlet.discardEvent(event)
|
inlet.discardEvent(event)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Called when collecting a finished child process
|
-- Called when collecting a finished child process
|
||||||
--
|
--
|
||||||
collect = function(agent, exitcode)
|
collect = function(agent, exitcode)
|
||||||
local config = agent.config
|
local config = agent.config
|
||||||
|
|
||||||
if not agent.isList and agent.etype == 'Init' then
|
if not agent.isList and agent.etype == 'Init' then
|
||||||
local rc = rsync_exitcodes[exitcode]
|
local rc = rsync_exitcodes[exitcode]
|
||||||
if rc == 'ok' then
|
if rc == 'ok' then
|
||||||
|
@ -3561,17 +3561,17 @@ local default_direct = {
|
||||||
return rc
|
return rc
|
||||||
end
|
end
|
||||||
|
|
||||||
-- everything else is just as it is,
|
-- everything else is just as it is,
|
||||||
-- there is no network to retry something.
|
-- there is no network to retry something.
|
||||||
return
|
return
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Spawns the recursive startup sync
|
-- Spawns the recursive startup sync
|
||||||
-- identical to default rsync.
|
-- identical to default rsync.
|
||||||
--
|
--
|
||||||
init = default_rsync.init,
|
init = default_rsync.init,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Checks the configuration.
|
-- Checks the configuration.
|
||||||
--
|
--
|
||||||
|
@ -3585,17 +3585,17 @@ local default_direct = {
|
||||||
-- Default delay is very short.
|
-- Default delay is very short.
|
||||||
--
|
--
|
||||||
delay = 1,
|
delay = 1,
|
||||||
|
|
||||||
------
|
------
|
||||||
-- Let the core not split move events.
|
-- Let the core not split move events.
|
||||||
--
|
--
|
||||||
onMove = true,
|
onMove = true,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- The rsync binary called.
|
-- The rsync binary called.
|
||||||
--
|
--
|
||||||
rsyncBinary = '/usr/bin/rsync',
|
rsyncBinary = '/usr/bin/rsync',
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- For startup sync
|
-- For startup sync
|
||||||
--
|
--
|
||||||
|
@ -3612,9 +3612,9 @@ local default_direct = {
|
||||||
-----
|
-----
|
||||||
-- The default table for the user to access.
|
-- The default table for the user to access.
|
||||||
-- Provides all the default layer 1 functions.
|
-- Provides all the default layer 1 functions.
|
||||||
--
|
--
|
||||||
-- TODO make readonly
|
-- TODO make readonly
|
||||||
--
|
--
|
||||||
default = {
|
default = {
|
||||||
|
|
||||||
-----
|
-----
|
||||||
|
@ -3635,7 +3635,7 @@ default = {
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Default collector.
|
-- Default collector.
|
||||||
-- Called when collecting a finished child process
|
-- Called when collecting a finished child process
|
||||||
|
@ -3720,7 +3720,7 @@ default = {
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Try not to have more than these delays.
|
-- Try not to have more than these delays.
|
||||||
-- not too large, since total calculation for stacking
|
-- not too large, since total calculation for stacking
|
||||||
-- events is n*log(n) or so..
|
-- events is n*log(n) or so..
|
||||||
--
|
--
|
||||||
maxDelays = 1000,
|
maxDelays = 1000,
|
||||||
|
@ -3729,12 +3729,12 @@ default = {
|
||||||
-- a default rsync configuration for easy usage.
|
-- a default rsync configuration for easy usage.
|
||||||
--
|
--
|
||||||
rsync = default_rsync,
|
rsync = default_rsync,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- a default rsync configuration with ssh'd move and rm actions
|
-- a default rsync configuration with ssh'd move and rm actions
|
||||||
--
|
--
|
||||||
rsyncssh = default_rsyncssh,
|
rsyncssh = default_rsyncssh,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- a default configuration using /bin/cp|rm|mv.
|
-- a default configuration using /bin/cp|rm|mv.
|
||||||
--
|
--
|
||||||
|
|
Loading…
Reference in New Issue