Log an error when removing keepalived.strikes file and it doesn't exit.

Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/0835e9ff
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/0835e9ff
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/0835e9ff

Branch: refs/heads/feature/systemvm-persistent-config
Commit: 0835e9ff86e1934070fed8bb3a6f8779bf8e43e4
Parents: 63d4832
Author: wilderrodrigues <[email protected]>
Authored: Thu Jan 8 12:48:25 2015 +0100
Committer: wilderrodrigues <[email protected]>
Committed: Wed Feb 4 18:47:05 2015 +0100

----------------------------------------------------------------------
 .../config/opt/cloud/templates/check_heartbeat.sh.templ  |  7 ++++++-
 .../root/redundant_router/check_heartbeat.sh.templ       | 11 ++++++++---
 2 files changed, 14 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0835e9ff/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
----------------------------------------------------------------------
diff --git 
a/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ 
b/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
index 051ee03..2bfb7cd 100755
--- 
a/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
+++ 
b/systemvm/patches/debian/config/opt/cloud/templates/check_heartbeat.sh.templ
@@ -35,7 +35,12 @@ then
         s=$(($s+1))
         echo $s > $STRIKE_FILE
     else
-        rm $STRIKE_FILE
+        if [ -e $STRIKE_FILE ]
+        then
+            rm $STRIKE_FILE
+        else
+            echo keepalived.strikes file does not exist! >> $ROUTER_LOG
+        fi
     fi
     #3 strikes rule
     if [ $s -gt 2 ]

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/0835e9ff/systemvm/patches/debian/config/root/redundant_router/check_heartbeat.sh.templ
----------------------------------------------------------------------
diff --git 
a/systemvm/patches/debian/config/root/redundant_router/check_heartbeat.sh.templ 
b/systemvm/patches/debian/config/root/redundant_router/check_heartbeat.sh.templ
index d7d211e..4253b29 100755
--- 
a/systemvm/patches/debian/config/root/redundant_router/check_heartbeat.sh.templ
+++ 
b/systemvm/patches/debian/config/root/redundant_router/check_heartbeat.sh.templ
@@ -16,8 +16,8 @@
 # specific language governing permissions and limitations
 # under the License.
 
-
-STRIKE_FILE="[RROUTER_BIN_PATH]/keepalived.strikes"
+ROUTER_BIN_PATH=/ramdisk/rrouter
+STRIKE_FILE="$ROUTER_BIN_PATH/keepalived.strikes"
 
 if [ -e [RROUTER_BIN_PATH]/keepalived.ts2 ]
 then
@@ -34,7 +34,12 @@ then
         s=$(($s+1))
         echo $s > $STRIKE_FILE
     else
-        rm $STRIKE_FILE
+        if [ -e $STRIKE_FILE ]
+        then
+            rm $STRIKE_FILE
+        else
+            echo keepalived.strikes file does not exist! >> $ROUTER_LOG
+        fi
     fi
     #3 strikes rule
     if [ $s -gt 2 ]

Reply via email to