Skip to content
Snippets Groups Projects
Commit 03cae796 authored by Erik Alexandre Pucci's avatar Erik Alexandre Pucci Committed by Josiney de Souza
Browse files

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
Branches
Tags
No related merge requests found
...@@ -50,8 +50,9 @@ function rotateLogFile() ...@@ -50,8 +50,9 @@ function rotateLogFile()
function checkUpdate() function checkUpdate()
{ {
updateLink="$(${CLIENT} --update)" 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 test -f "${TMPDIR}/SEED2-update.run" || rm -f ${TMPDIR}/SEED2-update.run
tryWget ${updateLink} \ tryWget ${updateLink} \
...@@ -65,11 +66,11 @@ function checkUpdate() ...@@ -65,11 +66,11 @@ function checkUpdate()
rm -f ${TMPDIR}/SEED2-update.run rm -f ${TMPDIR}/SEED2-update.run
# Return 4 only if this isn't the first execution of the agent # Return 0 if this is the first execution of the agent
test "${FIRST_EXECUTION}" || return 4 test "${FIRST_EXECUTION}" && return 0
fi fi
return 0 return ${returnValue}
} }
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
...@@ -149,7 +150,7 @@ updateStatus=$? ...@@ -149,7 +150,7 @@ updateStatus=$?
test "${FIRST_EXECUTION}" && echo "${REALVERSION}" > "${VERSIONFILE}" test "${FIRST_EXECUTION}" && echo "${REALVERSION}" > "${VERSIONFILE}"
test ${updateStatus} -eq 4 && exit 0 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." date +"%F %T - Error while updating agent."
exit 3 exit 3
fi fi
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment