This commit is contained in:
Axel Kittenberger 2010-11-13 20:31:24 +00:00
parent fc547790ea
commit ffb2ee7909
2 changed files with 29 additions and 6 deletions

View File

@ -8,5 +8,5 @@ settings = {
statusIntervall = 1, statusIntervall = 1,
} }
sync{default.rsync, source="src", target="dst/", excludeFrom="exclude"} sync{default.rsync, source="src", target="mooooooooooooooooooooo.com:dst/", excludeFrom="exclude"}

View File

@ -273,7 +273,7 @@ local Inlet, InletControl = (function()
-- TODO give user a readonly version. -- TODO give user a readonly version.
-- --
config = function(event) config = function(event)
return e2d[event].sync.config return sync.config
end, end,
inlet = function(event) inlet = function(event)
@ -869,6 +869,12 @@ local Sync = (function()
else else
-- sets the delay on wait again -- sets the delay on wait again
delay.status = "wait" 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 end
else else
log("Delay", "collected a list") log("Delay", "collected a list")
@ -878,6 +884,23 @@ local Sync = (function()
log("Error", "Critical exitcode."); log("Error", "Critical exitcode.");
terminate(-1) --ERRNO terminate(-1) --ERRNO
end 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 for k, d in pairs(delay) do
if type(k) == "number" then if type(k) == "number" then
if rc ~= "again" then if rc ~= "again" then
@ -2303,12 +2326,12 @@ local default_rssh = {
-- Called when collecting a finished child process -- Called when collecting a finished child process
-- --
collect = function(agent, exitcode) collect = function(agent, exitcode)
if agent.etype == "Blanket" then if not agent.isList and agent.etype == "Blanket" then
if exitcode == 0 then if exitcode == 0 then
log("Normal", "Startup of '",agent.source,"' finished.") log("Normal", "Startup of '",agent.source,"' finished.")
elseif rsync_exitcodes[exitcode] == "again" then elseif rsync_exitcodes[exitcode] == "again" then
log("Normal", log("Normal",
"Retring startup of '",agent.source,"' finished.") "Retrying startup of '",agent.source,"'.")
return "again" return "again"
else else
log("Error", "Failure on startup of '",agent.source,"'.") log("Error", "Failure on startup of '",agent.source,"'.")
@ -2462,14 +2485,14 @@ default = {
collect = function(agent, exitcode) collect = function(agent, exitcode)
local config = agent.config local config = agent.config
if agent.etype == "Blanket" then if not agent.isList and agent.etype == "Blanket" then
if exitcode == 0 then if exitcode == 0 then
log("Normal", "Startup of '",agent.source,"' finished.") log("Normal", "Startup of '",agent.source,"' finished.")
elseif config.exitcodes and elseif config.exitcodes and
config.exitcodes[exitcode] == "again" config.exitcodes[exitcode] == "again"
then then
log("Normal", log("Normal",
"Retring startup of '",agent.source,"' finished.") "Retrying startup of '",agent.source,"'.")
return "again" return "again"
else else
log("Error", "Failure on startup of '",agent.source,"'.") log("Error", "Failure on startup of '",agent.source,"'.")