Commit 03cae796 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Josiney de Souza Added $returnValue to check client errors during the agent update

This allows the verification of no Internet connection error during the
update process (as soon as the client isn't able to check the agent's

Changed the test(1) outside checkUpdate() from "-eq 1" to "-ne 0".

Changed test(1) inside checkUpdate() to return 0 if it's the first
execution of the agent.
Signed-off-by: default avatarErik Alexandre Pucci <>
Signed-off-by: default avatarJosiney de Souza <>
parent 2dbd41d5
......@@ -50,8 +50,9 @@ function rotateLogFile()
function checkUpdate()
updateLink="$(${CLIENT} --update)"
if test $? -eq 4; then
if test ${returnValue} -eq 4; then
test -f "${TMPDIR}/" || rm -f ${TMPDIR}/
tryWget ${updateLink} \
......@@ -65,11 +66,11 @@ function checkUpdate()
rm -f ${TMPDIR}/
# Return 4 only if this isn't the first execution of the agent
test "${FIRST_EXECUTION}" || return 4
# Return 0 if this is the first execution of the agent
test "${FIRST_EXECUTION}" && return 0
return 0
return ${returnValue}
......@@ -149,7 +150,7 @@ updateStatus=$?
test ${updateStatus} -eq 4 && exit 0
if test ${updateStatus} -eq 1; then
if test ${updateStatus} -ne 0; then
date +"%F %T - Error while updating agent."
exit 3
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment