chore(collector): add a check for process id in startup script

This commit is contained in:
xcaspar 2017-05-01 21:46:22 +08:00
parent ecf7a2bf2a
commit 39e414b680
1 changed files with 10 additions and 6 deletions

View File

@ -24,10 +24,14 @@ echo "Starting collector...."
eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} -classpath $CLASSPATH CollectorBootStartUp \
2>${COLLECTOR_LOGS_DIR}/collector.log 1> /dev/null &"
if [ $? -eq 0 ]; then
sleep 1
echo "Collector started successfully!"
else
echo "Collector started failure!"
exit 1
retval=$?
pid=$!
FAIL_MSG="Collector started failure!"
SUCCESS_MSG="Collector started successfully!"
[ ${retval} -eq 0 ] || (echo ${FAIL_MSG}; exit ${retval})
sleep 1
if ! ps -p ${pid} > /dev/null ; then
echo ${FAIL_MSG}
exit 1
fi
echo ${SUCCESS_MSG}