cleanups, adding SIGUSR1

This commit is contained in:
Axel Kittenberger 2018-06-11 09:32:04 +02:00
parent b438524df3
commit c3d1ae66ba
6 changed files with 57 additions and 99 deletions

View File

@ -255,49 +255,6 @@ default.maxDelays = 1000
default.maxProcesses = 1
--
-- Exitcodes of rsync and what to do.
-- TODO move to rsync
--
default.rsyncExitCodes = {
--
-- if another config provides the same table
-- this will not be inherited (merged) into that one
--
-- if it does not, integer keys are to be copied
-- verbatim
--
_merge = false,
_verbatim = true,
[ 0 ] = 'ok',
[ 1 ] = 'die',
[ 2 ] = 'die',
[ 3 ] = 'again',
[ 4 ] = 'die',
[ 5 ] = 'again',
[ 6 ] = 'again',
[ 10 ] = 'again',
[ 11 ] = 'again',
[ 12 ] = 'again',
[ 14 ] = 'again',
[ 20 ] = 'again',
[ 21 ] = 'again',
[ 22 ] = 'again',
-- partial transfers are ok, since Lsyncd has registered the event that
-- caused the transfer to be partial and will recall rsync.
[ 23 ] = 'ok',
[ 24 ] = 'ok',
[ 25 ] = 'die',
[ 30 ] = 'again',
[ 35 ] = 'again',
[ 255 ] = 'again',
}
--
-- Exitcodes of ssh and what to do.

View File

@ -630,9 +630,46 @@ end
rsync.delete = true
--
-- Rsyncd exitcodes
-- Exitcodes of rsync and what to do.
--
rsync.exitcodes = default.rsyncExitCodes
rsync.exitcodes =
{
--
-- if another config provides the same table
-- this will not be inherited (merged) into that one
--
-- if it does not, integer keys are to be copied
-- verbatim
--
_verbatim = true,
[ 0 ] = 'ok',
[ 1 ] = 'die',
[ 2 ] = 'die',
[ 3 ] = 'again',
[ 4 ] = 'die',
[ 5 ] = 'again',
[ 6 ] = 'again',
[ 10 ] = 'again',
[ 11 ] = 'again',
[ 12 ] = 'again',
[ 14 ] = 'again',
[ 20 ] = 'again',
[ 21 ] = 'again',
[ 22 ] = 'again',
-- partial transfers are ok, since Lsyncd has registered the event that
-- caused the transfer to be partial and will recall rsync.
[ 23 ] = 'ok',
[ 24 ] = 'ok',
[ 25 ] = 'die',
[ 30 ] = 'again',
[ 35 ] = 'again',
[ 255 ] = 'again',
}
--
-- Calls rsync with this default options

View File

@ -568,7 +568,7 @@ rsyncssh.exitcodes = false
--
-- rsync exit codes
--
rsyncssh.rsyncExitCodes = default.rsyncExitCodes
rsyncssh.rsyncExitCodes = rsync.exitCodes
--
-- ssh exit codes

View File

@ -94,6 +94,7 @@ init =
local hup = getsignal( 'HUP' )
local int = getsignal( 'INT' )
local term = getsignal( 'TERM' )
local usr1 = getsignal( 'USR1' )
if hup ~= false
then
@ -110,6 +111,11 @@ init =
term = makeSignalHandler( 'TERM', 'TERM', 'terminating', finishTerm )
end
onsignal( 'HUP', hup, 'INT', int, 'TERM', term )
if usr1 ~= false
then
usr1 = makeSignalHandler( 'USR1', nil, 'terminating', finishTerm )
end
onsignal( 'HUP', hup, 'INT', int, 'TERM', term, 'USR1', usr1 )
end

View File

@ -592,39 +592,3 @@ function mci.overflow
lsyncdStatus = 'fade'
end
--
-- Called by core on a hup signal.
-- FIXME remove
--
function mci.hup
( )
log( 'Normal', '--- HUP signal, resetting ---' )
lsyncdStatus = 'fade'
end
--
-- Called by core on a term signal.
-- FIXME remove
--
function mci.term
(
sigcode -- signal code
)
local sigtexts =
{
[ 2 ] = 'INT',
[ 15 ] = 'TERM'
}
local sigtext = sigtexts[ sigcode ]
if not sigtext then sigtext = 'UNKNOWN' end
log( 'Normal', '--- ', sigtext, ' signal, fading ---' )
lsyncdStatus = 'fade'
end

View File

@ -87,7 +87,7 @@ end
local inheritKV
--
-- Recurvely inherits a source table to a destionation table
-- Recursevly inherits a source table to a destionation table
-- copying all keys from source.
--
-- All entries with integer keys are inherited as additional
@ -108,17 +108,14 @@ local function inherit
-- non-integer keys
for k, v in pairs( cs )
do
if
(
type( k ) ~= 'number'
or verbatim
or cs._verbatim == true
)
and
(
type( cs._merge ) ~= 'table'
or cs._merge[ k ] == true
)
if (
type( k ) ~= 'number'
or verbatim
or cs._verbatim == true
) and (
type( cs._merge ) ~= 'table'
or cs._merge[ k ] == true
)
then
inheritKV( cd, k, v )
end
@ -340,10 +337,7 @@ local function concerns
)
for _, s in ipairs( syncList )
do
if s:concerns( path )
then
return true
end
if s:concerns( path ) then return true end
end
return false