mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-12-04 19:03:17 +00:00
This commit is contained in:
parent
fc547790ea
commit
ffb2ee7909
@ -8,5 +8,5 @@ settings = {
|
||||
statusIntervall = 1,
|
||||
}
|
||||
|
||||
sync{default.rsync, source="src", target="dst/", excludeFrom="exclude"}
|
||||
sync{default.rsync, source="src", target="mooooooooooooooooooooo.com:dst/", excludeFrom="exclude"}
|
||||
|
||||
|
33
lsyncd.lua
33
lsyncd.lua
@ -273,7 +273,7 @@ local Inlet, InletControl = (function()
|
||||
-- TODO give user a readonly version.
|
||||
--
|
||||
config = function(event)
|
||||
return e2d[event].sync.config
|
||||
return sync.config
|
||||
end,
|
||||
|
||||
inlet = function(event)
|
||||
@ -869,6 +869,12 @@ local Sync = (function()
|
||||
else
|
||||
-- sets the delay on wait again
|
||||
delay.status = "wait"
|
||||
local alarm = self.config.delay
|
||||
-- delays at least 1 second
|
||||
if alarm < 1 then
|
||||
alarm = 1
|
||||
end
|
||||
delay.alarm = lsyncd.addtoclock(lsyncd.now(), alarm)
|
||||
end
|
||||
else
|
||||
log("Delay", "collected a list")
|
||||
@ -878,6 +884,23 @@ local Sync = (function()
|
||||
log("Error", "Critical exitcode.");
|
||||
terminate(-1) --ERRNO
|
||||
end
|
||||
if rc == "again" then
|
||||
-- sets the delay on wait again
|
||||
delay.status = "wait"
|
||||
local alarm = self.config.delay
|
||||
-- delays at least 1 second
|
||||
if alarm < 1 then
|
||||
alarm = 1
|
||||
end
|
||||
alarm = lsyncd.addtoclock(lsyncd.now(), alarm)
|
||||
for k, d in pairs(delay) do
|
||||
if type(k) == "number" then
|
||||
d.alarm = alarm
|
||||
d.status = "wait"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
for k, d in pairs(delay) do
|
||||
if type(k) == "number" then
|
||||
if rc ~= "again" then
|
||||
@ -2303,12 +2326,12 @@ local default_rssh = {
|
||||
-- Called when collecting a finished child process
|
||||
--
|
||||
collect = function(agent, exitcode)
|
||||
if agent.etype == "Blanket" then
|
||||
if not agent.isList and agent.etype == "Blanket" then
|
||||
if exitcode == 0 then
|
||||
log("Normal", "Startup of '",agent.source,"' finished.")
|
||||
elseif rsync_exitcodes[exitcode] == "again" then
|
||||
log("Normal",
|
||||
"Retring startup of '",agent.source,"' finished.")
|
||||
"Retrying startup of '",agent.source,"'.")
|
||||
return "again"
|
||||
else
|
||||
log("Error", "Failure on startup of '",agent.source,"'.")
|
||||
@ -2462,14 +2485,14 @@ default = {
|
||||
collect = function(agent, exitcode)
|
||||
local config = agent.config
|
||||
|
||||
if agent.etype == "Blanket" then
|
||||
if not agent.isList and agent.etype == "Blanket" then
|
||||
if exitcode == 0 then
|
||||
log("Normal", "Startup of '",agent.source,"' finished.")
|
||||
elseif config.exitcodes and
|
||||
config.exitcodes[exitcode] == "again"
|
||||
then
|
||||
log("Normal",
|
||||
"Retring startup of '",agent.source,"' finished.")
|
||||
"Retrying startup of '",agent.source,"'.")
|
||||
return "again"
|
||||
else
|
||||
log("Error", "Failure on startup of '",agent.source,"'.")
|
||||
|
Loading…
Reference in New Issue
Block a user