From 31aeeaac63f3e267cbfe7f42ff382354e311ce6a Mon Sep 17 00:00:00 2001
From: Dmitry Simonenko <pmwkaa@gmail.com>
Date: Fri, 6 Sep 2013 13:57:54 +0400
Subject: [PATCH] rpm-start-activecheck: check for the active tarantool
 instance before starting another one.

---
 extra/tarantool_box | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)
 mode change 100755 => 100644 extra/tarantool_box

diff --git a/extra/tarantool_box b/extra/tarantool_box
old mode 100755
new mode 100644
index 3538a99ba6..ae855b5043
--- a/extra/tarantool_box
+++ b/extra/tarantool_box
@@ -32,8 +32,30 @@ then
         exit
 fi
 
+checkactive() {
+        if [ -f ${WRAP_PIDFILE} ]
+        then
+                ps -p $(cat ${WRAP_PIDFILE}) >/dev/null 2>&1
+                if [ $? -eq 0 ]; then
+                        echo -n "(instance is active)"
+                        echo_failure
+                        exit 1
+                fi
+        fi
+        if [ -f ${PIDFILE} ]
+        then
+                ps -p $(cat ${PIDFILE}) >/dev/null 2>&1
+                if [ $? -eq 0 ]; then
+                        echo -n "(instance is active)"
+                        echo_failure
+                        exit 1
+                fi
+        fi
+}
+
 start() {
         echo -n $"Starting ${INST}: "
+        checkactive
         /usr/bin/${INST}.sh ${OPTIONS} >> /var/${INST}/logs/init.log 2>&1
         RETVAL=${?}
         if [ ${RETVAL} -eq 0 ]
-- 
GitLab