Skip to content
Snippets Groups Projects
Commit 6a45a27c authored by Diego Giovane Pasqualin's avatar Diego Giovane Pasqualin
Browse files

Merge branch 'fix-lastexec-permission-denied' of /home/git/repositories/proinfodata/unstable

parents 002e9f74 aafe8d6a
No related branches found
No related tags found
No related merge requests found
......@@ -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 ||
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment