mirror of
https://github.com/octoleo/lsyncd.git
synced 2024-06-06 02:10:51 +00:00
mark startup events as startup event, so scripts can use it to destinguish to their own blanketevents
This commit is contained in:
parent
eaad46b7e7
commit
ea065d5286
19
lsyncd.lua
19
lsyncd.lua
|
@ -3126,6 +3126,8 @@ local default_rsync = {
|
||||||
init = function(inlet)
|
init = function(inlet)
|
||||||
local config = inlet.getConfig()
|
local config = inlet.getConfig()
|
||||||
local event = inlet.createBlanketEvent()
|
local event = inlet.createBlanketEvent()
|
||||||
|
event.isStartup = true -- marker for user scripts
|
||||||
|
|
||||||
if string.sub(config.target, -1) ~= "/" then
|
if string.sub(config.target, -1) ~= "/" then
|
||||||
config.target = config.target .. "/"
|
config.target = config.target .. "/"
|
||||||
end
|
end
|
||||||
|
@ -3152,9 +3154,18 @@ local default_rsync = {
|
||||||
config.target)
|
config.target)
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
|
|
||||||
|
-----
|
||||||
|
-- Checks the configuration.
|
||||||
|
--
|
||||||
|
prepare = function(config)
|
||||||
|
if not config.target then
|
||||||
|
error("default.rsync needs 'target' configured", 4)
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Calls rsync with this options.
|
-- Calls rsync with this default short opts.
|
||||||
--
|
--
|
||||||
rsyncOps = "-lts",
|
rsyncOps = "-lts",
|
||||||
|
|
||||||
|
@ -3303,6 +3314,7 @@ local default_rsyncssh = {
|
||||||
init = function(inlet)
|
init = function(inlet)
|
||||||
local config = inlet.getConfig()
|
local config = inlet.getConfig()
|
||||||
local event = inlet.createBlanketEvent()
|
local event = inlet.createBlanketEvent()
|
||||||
|
event.isStartup = true -- marker for user scripts
|
||||||
if string.sub(config.targetdir, -1) ~= "/" then
|
if string.sub(config.targetdir, -1) ~= "/" then
|
||||||
config.targetdir = config.targetdir .. "/"
|
config.targetdir = config.targetdir .. "/"
|
||||||
end
|
end
|
||||||
|
@ -3337,7 +3349,7 @@ local default_rsyncssh = {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Checks the configuration
|
-- Checks the configuration.
|
||||||
--
|
--
|
||||||
prepare = function(config)
|
prepare = function(config)
|
||||||
if not config.host then
|
if not config.host then
|
||||||
|
@ -3349,7 +3361,7 @@ local default_rsyncssh = {
|
||||||
end,
|
end,
|
||||||
|
|
||||||
-----
|
-----
|
||||||
-- Calls rsync with this options
|
-- Calls rsync with this default short opts.
|
||||||
--
|
--
|
||||||
rsyncOps = "-lts",
|
rsyncOps = "-lts",
|
||||||
|
|
||||||
|
@ -3459,6 +3471,7 @@ default = {
|
||||||
-- calls a startup if given by user script.
|
-- calls a startup if given by user script.
|
||||||
if type(config.onStartup) == "function" then
|
if type(config.onStartup) == "function" then
|
||||||
local event = inlet.createBlanketEvent()
|
local event = inlet.createBlanketEvent()
|
||||||
|
event.isStartup = true -- marker for user scripts
|
||||||
local startup = config.onStartup(event)
|
local startup = config.onStartup(event)
|
||||||
if event.status == "wait" then
|
if event.status == "wait" then
|
||||||
-- user script did not spawn anything
|
-- user script did not spawn anything
|
||||||
|
|
Loading…
Reference in New Issue
Block a user