diff --git a/azkaban-exec-server/src/bin/internal/internal-start-executor.sh b/azkaban-exec-server/src/bin/internal/internal-start-executor.sh index 3dcd407..fce781e 100644 --- a/azkaban-exec-server/src/bin/internal/internal-start-executor.sh +++ b/azkaban-exec-server/src/bin/internal/internal-start-executor.sh @@ -96,7 +96,15 @@ function start(){ LOG INFO "Starting AzkabanExecutorServer on port $executorport ..." java $AZKABAN_OPTS $JAVA_LIB_PATH -cp $CLASSPATH azkaban.execapp.AzkabanExecutorServer -conf $conf $@ >> $logFile 2>&1 & echo $! > $azkaban_dir/currentpid - LOG INFO "AzkabanExecutorServer started successfully." + sleep 3s + processName=`jps|grep AzkabanExecutorServer` + if [ ! -n "$processName" ] + then + LOG INFO "AzkabanExecutorServer startup failed" + return 1 + else + return 0 + fi } function genServerId(){ @@ -126,27 +134,30 @@ function updataExecutorStatus(){ runtime=0 while [[ $start_finish != 1 ]]; do result=`curl -POST http://${LOCAL_HOSTNAME}:${EXECUTOR_PORT}/executor -d action=activate` - LOG INFO " 执行结果: ${result}" + LOG INFO " exectue result: ${result}" [[ "${result}" =~ .*success.* ]] && { break; } - sleep 5s + sleep 3s runtime=$(( $runtime + 1 )) - LOG INFO " 当前运行次数为: ${runtime} 超过30次将退出。" - if [ ${runtime} -gt 30 ] + LOG INFO "It has been run: ${runtime} and will exit after 10 times。" + if [ ${runtime} -gt 10 ] then LOG ERROR "update executor status time out." return 1 fi done - LOG INFO " 执行节点启动成功,更新数据库状态。" LOG INFO "update executor success." + LOG INFO "AzkabanExecutorServer started successfully." } function preCheck(){ LOG INFO "checking AzkabanExecutorServer status..." - if [ -f $azkaban_dir/currentpid ] + processName=`jps|grep AzkabanExecutorServer` + if [ -n "$processName" ] then - LOG INFO "AzkabanExecutorServer already started." - return 1 + LOG INFO "AzkabanExecutorServer already started." + return 1 + else + return 0 fi } diff --git a/azkaban-web-server/src/bin/internal/internal-start-web.sh b/azkaban-web-server/src/bin/internal/internal-start-web.sh index 56baa3b..41f7e6a 100644 --- a/azkaban-web-server/src/bin/internal/internal-start-web.sh +++ b/azkaban-web-server/src/bin/internal/internal-start-web.sh @@ -27,11 +27,14 @@ logFile=/appcom/logs/azkaban/webServerLog_`date +%F+%T`.out function preCheck(){ - LOG INFO "checking AzkabanWebServer process status..." - if [ -f $azkaban_dir/currentpid ] + LOG INFO "checking AzkabanWebServer status..." + processName=`jps|grep AzkabanWebServer` + if [ -n "$processName" ] then - LOG INFO "AzkabanWebServer already started." - return 1 + LOG INFO "AzkabanWebServer already started." + return 1 + else + return 0 fi } @@ -99,7 +102,15 @@ function start(){ LOG INFO "starting AzkabanWebServer..." java $AZKABAN_OPTS $JAVA_LIB_PATH -cp $CLASSPATH azkaban.webapp.AzkabanWebServer -conf $conf $cycle_stop $@ >> $logFile 2>&1 & echo $! > $azkaban_dir/currentpid - LOG INFO "AzkabanWebServer started successfully." + sleep 3s + processName=`jps|grep AzkabanWebServer` + if [ ! -n "$processName" ] + then + LOG INFO "AzkabanWebServer startup failed" + return 1 + else + return 0 + fi } function LOG(){