Checking for existence of lock file before removing

Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/7e6b3365
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/7e6b3365
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/7e6b3365

Branch: refs/heads/master
Commit: 7e6b3365d74be78f5a1b32bac52850cdd51c0d70
Parents: d35a000
Author: anuruddhal <[email protected]>
Authored: Wed Mar 11 17:12:07 2015 +0530
Committer: Imesh Gunaratne <[email protected]>
Committed: Sat Mar 14 11:20:56 2015 +0530

----------------------------------------------------------------------
 tools/puppet3-agent/config.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/7e6b3365/tools/puppet3-agent/config.sh
----------------------------------------------------------------------
diff --git a/tools/puppet3-agent/config.sh b/tools/puppet3-agent/config.sh
index 4e4cbc2..742155b 100755
--- a/tools/puppet3-agent/config.sh
+++ b/tools/puppet3-agent/config.sh
@@ -33,6 +33,7 @@ CP=`which cp`
 MV=`which mv`
 
 HOSTSFILE=/etc/hosts
+LOCKFILE=/mnt/apache-stratos-cartridge-agent-4.0.0/wso2carbon.lck
 DATE=`date +%d%m%y%S`
 RANDOMNUMBER="`${TR} -c -d 0-9 < /dev/urandom | ${HEAD} -c 4`${DATE}"
 
@@ -88,7 +89,11 @@ if [[ $answer = y ]] ; then
        ARGS=("-n${NODEID}" "-d${DOMAIN}" "-s${PUPPET_IP}")
        ${ECHO} "\nRunning puppet installation with arguments: ${ARGS[@]}"
        /root/bin/puppetinstall/puppetinstall "${ARGS[@]}"
-        ${RM} /mnt/apache-stratos-cartridge-agent-4.0.0/wso2carbon.lck
+       #check for java agent lock file
+       if [ -e ${LOCKFILE} ]; then
+    ${RM} ${LOCKFILE}
+       fi
+
        ${GREP} -q '/root/bin/init.sh > /tmp/puppet_log' /etc/rc.local || 
${SED} -i 's/exit 0$/\/root\/bin\/init.sh \> \/tmp\/puppet_log\nexit 0/' 
/etc/rc.local
        ${RM} -rf /tmp/*
        ${RM} -rf /var/lib/puppet/ssl/*

Reply via email to