mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-13 14:43:09 +00:00
Finish full sync cron trigger
This commit is contained in:
parent
5b42d69193
commit
66b038e394
@ -129,7 +129,16 @@ direct.action = function(inlet)
|
|||||||
event.targetPath,
|
event.targetPath,
|
||||||
event2.targetPath
|
event2.targetPath
|
||||||
)
|
)
|
||||||
|
elseif event.etype == 'Full' then
|
||||||
|
local tp = event.targetPath
|
||||||
|
|
||||||
|
-- extra security check
|
||||||
|
if tp == '' or tp == '/' or not tp then
|
||||||
|
error('Refusing to erase your harddisk!')
|
||||||
|
end
|
||||||
|
|
||||||
|
-- trigger full sync function
|
||||||
|
direct.full(event)
|
||||||
else
|
else
|
||||||
log('Warn', 'ignored an event of type "',event.etype, '"')
|
log('Warn', 'ignored an event of type "',event.etype, '"')
|
||||||
inlet.discardEvent(event)
|
inlet.discardEvent(event)
|
||||||
@ -177,6 +186,12 @@ end
|
|||||||
--
|
--
|
||||||
direct.init = default.rsync.init
|
direct.init = default.rsync.init
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Spawns the recursive startup sync
|
||||||
|
-- (currently) identical to default rsync.
|
||||||
|
--
|
||||||
|
direct.full = default.rsync.full
|
||||||
|
|
||||||
--
|
--
|
||||||
-- Checks the configuration.
|
-- Checks the configuration.
|
||||||
--
|
--
|
||||||
|
@ -313,6 +313,16 @@ rsync.init = function
|
|||||||
(
|
(
|
||||||
event
|
event
|
||||||
)
|
)
|
||||||
|
return rsync.full(event)
|
||||||
|
end
|
||||||
|
|
||||||
|
--
|
||||||
|
-- Triggers a full sync event
|
||||||
|
--
|
||||||
|
rsync.full = function
|
||||||
|
(
|
||||||
|
event
|
||||||
|
)
|
||||||
local config = event.config
|
local config = event.config
|
||||||
|
|
||||||
local inlet = event.inlet
|
local inlet = event.inlet
|
||||||
|
@ -42,6 +42,7 @@ default.checkgauge = {
|
|||||||
delay = true,
|
delay = true,
|
||||||
exitcodes = true,
|
exitcodes = true,
|
||||||
init = true,
|
init = true,
|
||||||
|
full = true,
|
||||||
maxDelays = true,
|
maxDelays = true,
|
||||||
maxProcesses = true,
|
maxProcesses = true,
|
||||||
onAttrib = true,
|
onAttrib = true,
|
||||||
@ -50,6 +51,7 @@ default.checkgauge = {
|
|||||||
onDelete = true,
|
onDelete = true,
|
||||||
onStartup = true,
|
onStartup = true,
|
||||||
onMove = true,
|
onMove = true,
|
||||||
|
onFull = true,
|
||||||
prepare = true,
|
prepare = true,
|
||||||
source = true,
|
source = true,
|
||||||
target = true,
|
target = true,
|
||||||
|
@ -1006,6 +1006,11 @@ local Combiner = ( function
|
|||||||
return 'stack'
|
return 'stack'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- A full sync does not affect us
|
||||||
|
if d1.etype == 'Full' or d2.etype == 'Full' then
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
-- two normal events
|
-- two normal events
|
||||||
if d1.etype ~= 'Move' and d2.etype ~= 'Move'
|
if d1.etype ~= 'Move' and d2.etype ~= 'Move'
|
||||||
then
|
then
|
||||||
@ -3027,7 +3032,7 @@ local Sync = ( function
|
|||||||
-- time fo a full sync
|
-- time fo a full sync
|
||||||
log('Info', 'Crontab triggered full sync')
|
log('Info', 'Crontab triggered full sync')
|
||||||
-- TODO
|
-- TODO
|
||||||
|
self:delay("Full", timestamp, "/", nil)
|
||||||
updateNextCronAlarm(self, timestamp)
|
updateNextCronAlarm(self, timestamp)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -4144,6 +4149,7 @@ local Syncs = ( function
|
|||||||
and not config.onModify
|
and not config.onModify
|
||||||
and not config.onDelete
|
and not config.onDelete
|
||||||
and not config.onMove
|
and not config.onMove
|
||||||
|
and not config.onFull
|
||||||
then
|
then
|
||||||
local info = debug.getinfo( 3, 'Sl' )
|
local info = debug.getinfo( 3, 'Sl' )
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user