Commit 03cae796 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Josiney de Souza

agent.sh: 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
version).

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 <eap08@c3sl.ufpr.br>
Signed-off-by: default avatarJosiney de Souza <josineys@c3sl.ufpr.br>
parent 2dbd41d5
......@@ -50,8 +50,9 @@ function rotateLogFile()
function checkUpdate()
{
updateLink="$(${CLIENT} --update)"
returnValue=$?
if test $? -eq 4; then
if test ${returnValue} -eq 4; then
test -f "${TMPDIR}/SEED2-update.run" || rm -f ${TMPDIR}/SEED2-update.run
tryWget ${updateLink} \
......@@ -65,11 +66,11 @@ function checkUpdate()
rm -f ${TMPDIR}/SEED2-update.run
# 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
fi
return 0
return ${returnValue}
}
#------------------------------------------------------------------------------
......@@ -149,7 +150,7 @@ updateStatus=$?
test "${FIRST_EXECUTION}" && echo "${REALVERSION}" > "${VERSIONFILE}"
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
fi
......
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