Merge pull request #188 from xcaspar/feature/180

chore(collector): add a check for process id in startup script
This commit is contained in:
吴晟 Wu Sheng 2017-06-06 11:08:48 +08:00 committed by GitHub
commit d39cff6ddc
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 org.skywalking.apm.collector.worker.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}