From 5a6416dd70edb1e7fd635ab7642534bc4e71f173 Mon Sep 17 00:00:00 2001
From: edileuton <edileuton@gmail.com>
Date: Wed, 29 Jan 2014 11:20:14 -0200
Subject: [PATCH] agent: Fix permission denied to acess lastexec file

Signed-off-by: edileuton <edileuton@gmail.com>
---
 agent/bootstrap/install | 19 ++++++++++---------
 1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/agent/bootstrap/install b/agent/bootstrap/install
index 05fca51..29c5ad2 100644
--- a/agent/bootstrap/install
+++ b/agent/bootstrap/install
@@ -246,6 +246,16 @@ cp -a ".md5sum" ".backup/"
 
 printf "OK!\n" >&3
 
+# Restore lastexec
+if ! test -z ${LASTEXECBACKUP};then
+	echo ${LASTEXECBACKUP} > ${LASTEXEC}
+fi
+
+# Restore netlastexec
+if ! test -z ${NETLASTEXECBACKUP};then
+	echo ${NETLASTEXECBACKUP} > ${NETLASTEXEC}
+fi
+
 # Change files owner
 if ! chown -R datasid:datasid "${DATASID_HOME}"; then
     printf "FALHA!\n" >&3
@@ -260,15 +270,6 @@ printf "Executando o agente pela primeira vez... " >&3
 # Export a variable to inform the agent that this is its first execution
 export FIRST_EXECUTION=1
 
-# Restore lastexec
-if ! test -z ${LASTEXECBACKUP};then
-	echo ${LASTEXECBACKUP} > ${LASTEXEC}
-fi
-
-if ! test -z ${NETLASTEXECBACKUP};then
-	echo ${NETLASTEXECBACKUP} > ${NETLASTEXEC}
-fi
-
 # Run the agent and check if its execution was alright, exiting in case of error
 su -c "bash ${DATASID_HOME}/bin/datasid-agent.sh" datasid
 RETVAL=$?
-- 
GitLab