Commit aafe8d6a authored by Edileuton Henrique de Oliveira's avatar Edileuton Henrique de Oliveira
Browse files

bootstraps: Fix lastexec access permission denied


Signed-off-by: default avatarEdileuton Henrique de Oliveira <eho09@c3sl.ufpr.br>
parent 87a3b2f1
......@@ -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 ||
......
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