diff --git a/build/bootstraps/bootstrap-install.sh b/build/bootstraps/bootstrap-install.sh index 53f11f0858d53f3c6d1d10aa8374ab1751d37b42..6c1194bcf5f761121b7276eb47e88d58c8328972 100755 --- a/build/bootstraps/bootstrap-install.sh +++ b/build/bootstraps/bootstrap-install.sh @@ -171,11 +171,11 @@ exec 3>&1 &> ${LOGFILE} # Check if last-exec.tmp exist then save its content to prevent that # agent send a inventory more than once per day if test -f ${LASTEXEC}; then - LASTEXECBACKUP=$(cat ${LASTEXEC}) + LASTEXECBACKUP=$(cat ${LASTEXEC}) fi if test -f ${NETLASTEXEC}; then - NETLASTEXECBACKUP=$(cat ${NETLASTEXEC}) + NETLASTEXECBACKUP=$(cat ${NETLASTEXEC}) fi # Remove any previous installation of the agent @@ -261,6 +261,15 @@ rm -rf "${AGENT_DIR}" &> /dev/null tar xzf "${FILE}" &> /dev/null rm -rf "${FILE}" &> /dev/null +# Restore last-exec.tmp +if ! test -z ${LASTEXECBACKUP};then + echo ${LASTEXECBACKUP} > ${LASTEXEC} +fi +# Restore net-last-exec.tmp +if ! test -z ${NETLASTEXECBACKUP};then + echo ${NETLASTEXECBACKUP} > ${NETLASTEXEC} +fi + # Change files' owner if ! chown -R seed_mec:seed_mec "${SEED_MEC_HOME}"; then rm -rf "${SEED_MEC_HOME}" &> /dev/null @@ -272,15 +281,6 @@ fi # Export a variable to inform the agent that this is its first execution export FIRST_EXECUTION=1 -# Restore last-exec.tmp -if ! test -z ${LASTEXECBACKUP};then - echo ${LASTEXECBACKUP} > ${LASTEXEC} -fi -# Restore net-last-exec.tmp -if ! test -z ${NETLASTEXECBACKUP};then - echo ${NETLASTEXECBACKUP} > ${NETLASTEXEC} -fi - # Run the agent and check if its execution went alright, exiting in case of # error if ! su -c "bash ${AGENT_DIR}/update.sh" seed_mec ||