You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@chukwa.apache.org by ey...@apache.org on 2015/04/18 07:13:44 UTC
[4/4] chukwa git commit: CHUKWA-743. Revised pid locking using
standard Hadoop approach. (Eric Yang)
CHUKWA-743. Revised pid locking using standard Hadoop approach. (Eric Yang)
Project: http://git-wip-us.apache.org/repos/asf/chukwa/repo
Commit: http://git-wip-us.apache.org/repos/asf/chukwa/commit/6def7b64
Tree: http://git-wip-us.apache.org/repos/asf/chukwa/tree/6def7b64
Diff: http://git-wip-us.apache.org/repos/asf/chukwa/diff/6def7b64
Branch: refs/heads/master
Commit: 6def7b64d294f13ff2ef50e783d32cd0384c949f
Parents: ecf9b2b
Author: Eric Yang <ey...@apache.org>
Authored: Fri Apr 17 22:13:20 2015 -0700
Committer: Eric Yang <ey...@apache.org>
Committed: Fri Apr 17 22:13:20 2015 -0700
----------------------------------------------------------------------
bin/chukwa | 29 +++++++++++++++++------------
1 file changed, 17 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/chukwa/blob/6def7b64/bin/chukwa
----------------------------------------------------------------------
diff --git a/bin/chukwa b/bin/chukwa
index 3b60f14..1a3a341 100755
--- a/bin/chukwa
+++ b/bin/chukwa
@@ -155,18 +155,23 @@ pid="$CHUKWA_PID_DIR/chukwa-$CHUKWA_IDENT_STRING-$COMMAND.pid"
if [ "$1" = "start" ]; then
if [ -f $pid ]; then
TARGET_PID=`cat $pid`
- if [ $TARGET_PID == $$ ]; then
- # run command
- exec ${JAVA_HOME}/bin/java ${JAVA_OPT} \
- -Djava.library.path=${JAVA_LIBRARY_PATH} \
- -DCHUKWA_HOME=${CHUKWA_HOME} \
- -DCHUKWA_CONF_DIR=${CHUKWA_CONF_DIR} \
- -DCHUKWA_LOG_DIR=${CHUKWA_LOG_DIR} \
- -DCHUKWA_DATA_DIR=${CHUKWA_DATA_DIR} \
- -DAPP=${APP} -Dlog4j.configuration=chukwa-log4j.properties \
- -classpath ${CHUKWA_CONF_DIR}:${CLASSPATH}:${CHUKWA_CLASSPATH}:${tools} ${CLASS} $OPTS $@
- elif kill -0 `cat $pid` > /dev/null 2>&1; then
- echo $COMMAND running as process `cat $pid`. Stop it first.
+ if kill -0 `cat $pid` > /dev/null 2>&1; then
+ if [ $TARGET_PID == $$ ]; then
+ # run command
+ exec ${JAVA_HOME}/bin/java ${JAVA_OPT} \
+ -Djava.library.path=${JAVA_LIBRARY_PATH} \
+ -DCHUKWA_HOME=${CHUKWA_HOME} \
+ -DCHUKWA_CONF_DIR=${CHUKWA_CONF_DIR} \
+ -DCHUKWA_LOG_DIR=${CHUKWA_LOG_DIR} \
+ -DCHUKWA_DATA_DIR=${CHUKWA_DATA_DIR} \
+ -DAPP=${APP} -Dlog4j.configuration=chukwa-log4j.properties \
+ -classpath ${CHUKWA_CONF_DIR}:${CLASSPATH}:${CHUKWA_CLASSPATH}:${tools} ${CLASS} $OPTS $@
+ else
+ echo $COMMAND running as process `cat $pid`. Stop it first.
+ exit 1
+ fi
+ else
+ echo $COMMAND is not running, but found pid file $pid.
exit 1
fi
fi