Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files
CHUKWA-691. Improve pid file handling. (Eric Yang)
git-svn-id: https://svn.apache.org/repos/asf/incubator/chukwa/trunk@1500352 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information
macroadster committed Jul 7, 2013
1 parent 0e33e11 commit e138ae2f97ec43ef722d748148512307f2dee990
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
@@ -30,6 +30,8 @@ Trunk (unreleased changes)

BUGS

CHUKWA-691. Improve pid file handling. (Eric Yang)

CHUKWA-565. Added support HBaseWriter support for TsProcessor. (Bill Graham via Eric Yang)

CHUKWA-677. Added pid file check before starting processes. (Sreepathi Prasanna via Eric Yang)
@@ -162,8 +162,15 @@ fi

pid="${CHUKWA_PID_DIR}/$PID.pid"
if [ "$1" = "stop" ]; then
if [ -e $pid ]; then
kill -TERM `cat $pid`
if [ -e $pid ]; then
TARGET_PID=`cat $pid`
if kill -0 $TARGET_PID > /dev/null 2>&1; then
kill -TERM $TARGET_PID
sleep $CHUKWA_STOP_TIMEOUT
if kill -0 $TARGET_PID > /dev/null 2>&1; then
kill -9 $TARGET_PID
fi
fi
else
echo "Cannot find PID file - $PID.pid; NO $PID to stop";
fi
@@ -178,6 +185,7 @@ else
${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
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 $@ &
sleep 1
fi
fi

@@ -82,3 +82,4 @@ if [ -z "$JAVA_HOME" ] ; then
echo ERROR! You forgot to set JAVA_HOME in CHUKWA_CONF_DIR/chukwa-env.sh
fi

CHUKWA_STOP_TIMEOUT=${CHUKWA_STOP_TIMEOUT:-3}

0 comments on commit e138ae2

Please sign in to comment.