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