falcon-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ajayyad...@apache.org
Subject [2/3] falcon git commit: FALCON-1756 Remove PID files on service stop. Contributed by Deepak Barr.
Date Wed, 27 Jan 2016 20:32:31 GMT
FALCON-1756 Remove PID files on service stop. Contributed by Deepak Barr.


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

Branch: refs/heads/master
Commit: a30a1acd648f8bb4e2ac5849ef663af7f4569e38
Parents: ba8dab9
Author: Ajay Yadava <ajaynsit@gmail.com>
Authored: Thu Jan 28 01:16:25 2016 +0530
Committer: Ajay Yadava <ajaynsit@gmail.com>
Committed: Thu Jan 28 01:16:25 2016 +0530

----------------------------------------------------------------------
 CHANGES.txt             |  2 ++
 src/bin/service-stop.sh | 17 ++++++++++++++++-
 2 files changed, 18 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/falcon/blob/a30a1acd/CHANGES.txt
----------------------------------------------------------------------
diff --git a/CHANGES.txt b/CHANGES.txt
index f36de10..9fb66ef 100755
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -10,6 +10,8 @@ Trunk
 
     FALCON-1230 Data based notification Service to notify execution instances when data becomes
available(Pavan Kumar Kolamuri via Ajay Yadava)
   IMPROVEMENTS
+    FALCON-1756 Remove PID files on service stop(Deepak Barr via Ajay Yadava)
+
     FALCON-1771 Tool to merge pull requests (Ajay Yadava)
 
     FALCON-1770 Update README file (Ajay Yadava)

http://git-wip-us.apache.org/repos/asf/falcon/blob/a30a1acd/src/bin/service-stop.sh
----------------------------------------------------------------------
diff --git a/src/bin/service-stop.sh b/src/bin/service-stop.sh
index 5c08c29..e9dcc07 100755
--- a/src/bin/service-stop.sh
+++ b/src/bin/service-stop.sh
@@ -32,9 +32,24 @@ BASEDIR=`cd ${BASEDIR}/..;pwd`
 APP_TYPE=$1
 . ${BASEDIR}/bin/falcon-config.sh 'server' "$APP_TYPE"
 
+STOP_TIMEOUT=10
 if [ -f $FALCON_PID_FILE ]
 then
-   kill -15 `cat $FALCON_PID_FILE`
+   PID=`cat $FALCON_PID_FILE`
+   echo "Stopping $APP_TYPE running as $PID"
+   kill -15 $PID
+   WAIT=0
+   while [ $(ps -p$PID -o pid=) > /dev/null ] && [ $WAIT -lt $STOP_TIMEOUT ];
do
+             echo -n "."
+             sleep 1
+             (( WAIT++ ))
+   done
+   if [ $(ps -p$PID -o pid=) > /dev/null ]; then
+     echo -e "\nWARN: $APP_TYPE did not stop after $STOP_TIMEOUT seconds : Killing with kill
-9"
+     kill -9 $PID
+   fi
+   rm -f $FALCON_PID_FILE
+   echo "Stopped $APP_TYPE !"
 else
    echo "pid file $FALCON_PID_FILE not present"
 fi


Mime
View raw message