You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@chukwa.apache.org by ey...@apache.org on 2012/12/19 21:21:52 UTC

svn commit: r1424080 - in /incubator/chukwa/trunk: CHANGES.txt bin/chukwa

Author: eyang
Date: Wed Dec 19 20:21:52 2012
New Revision: 1424080

URL: http://svn.apache.org/viewvc?rev=1424080&view=rev
Log:
CHUKWA-677. Added pid file check before starting processes. (Sreepathi Prasanna via Eric Yang)

Modified:
    incubator/chukwa/trunk/CHANGES.txt
    incubator/chukwa/trunk/bin/chukwa

Modified: incubator/chukwa/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/chukwa/trunk/CHANGES.txt?rev=1424080&r1=1424079&r2=1424080&view=diff
==============================================================================
--- incubator/chukwa/trunk/CHANGES.txt (original)
+++ incubator/chukwa/trunk/CHANGES.txt Wed Dec 19 20:21:52 2012
@@ -30,6 +30,8 @@ Trunk (unreleased changes)
 
   BUGS
 
+    CHUKWA-677. Added pid file check before starting processes. (Sreepathi Prasanna via Eric Yang)
+
     CHUKWA-676. Exclude temporarily data from release audit tools. (Eric Yang)
 
     CHUKWA-672. Fix adaptor not found in checkpoint after shutdown. (shreyas subramanya via asrabkin)

Modified: incubator/chukwa/trunk/bin/chukwa
URL: http://svn.apache.org/viewvc/incubator/chukwa/trunk/bin/chukwa?rev=1424080&r1=1424079&r2=1424080&view=diff
==============================================================================
--- incubator/chukwa/trunk/bin/chukwa (original)
+++ incubator/chukwa/trunk/bin/chukwa Wed Dec 19 20:21:52 2012
@@ -160,12 +160,18 @@ elif [ "$COMMAND" = "tail" ]; then
   exit 0
 fi
 
+pid="${CHUKWA_PID_DIR}/$PID.pid"
 if [ "$1" = "stop" ]; then
-  if [ -e ${CHUKWA_PID_DIR}/$PID.pid ]; then 
-    kill -TERM `cat ${CHUKWA_PID_DIR}/$PID.pid`
+  if [ -e $pid ]; then 
+    kill -TERM `cat $pid`
   else 
     echo "Cannot find PID file - $PID.pid; NO $PID to stop";
   fi
+elif [ -f $pid ]; then
+ if kill -0 `cat $pid` > /dev/null 2>&1; then
+    echo $command running as process `cat $pid`.  Stop it first.
+    exit 1
+ fi
 else 
   # run command
   if [ "$BACKGROUND" = "false" ]; then