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

buildpackage: The date of the netusage inventory's send is kept of the previous agent


Signed-off-by: default avatarEdileuton Henrique de Oliveira <eho09@c3sl.ufpr.br>
parent 63df1c8b
......@@ -156,17 +156,22 @@ else
SEED_MEC_HOME="/opt/seed_mec"
fi
AGENT_DIR="${SEED_MEC_HOME}/SEED2"
LASTEXEC="${AGENT_DIR}/tmp/lastExec.tmp"
LASTEXEC="${AGENT_DIR}/tmp/last-exec.tmp"
NETLASTEXEC="${AGENT_DIR}/tmp/net-last-exec.tmp"
LOGFILE=/tmp/collected-information.log
# Save stdout to file descriptor 3 and redirect all output to $LOGFILE
exec 3>&1 &> ${LOGFILE}
# Check if lastExec.tmp exist then save its content to prevent that
# 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})
fi
if test -f ${NETLASTEXEC}; then
NETLASTEXECBACKUP=$(cat ${NETLASTEXEC})
fi
# Remove any previous installation of the agent
rm -rf "${AGENT_DIR}"
/usr/sbin/userdel -r seed_mec
......@@ -253,10 +258,14 @@ fi
# Export a variable to inform the agent that this is its first execution
export FIRST_EXECUTION=1
# Restore lastExec.tmp
# 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
......
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