Commit 10689cfe authored by tywldx's avatar tywldx
parents 7243d7e6 09dd9d59
...@@ -34,11 +34,10 @@ function ack() ...@@ -34,11 +34,10 @@ function ack()
fail_flag=`grep -E "APPLICATION FAILED TO START|Application startup failed" ${log_path} | wc -l` fail_flag=`grep -E "APPLICATION FAILED TO START|Application startup failed" ${log_path} | wc -l`
if [ "${fail_flag}" = 1 ];then if [ "${fail_flag}" = 1 ];then
echo "server $ip $project startup failed in ${wait_ack_time} seconds..." echo "server $ip $project startup failed in ${wait_ack_time} seconds..."
num=`grep -n "\[ERROR\]" $log_path | head -1 |cut -d ":" -f 1` num=`grep -n -E "APPLICATION FAILED TO START|Application startup failed" $log_path | cut -d ":" -f 1`
if [ -n "$num" ];then if [ -n "$num" ];then
echo "server $ip $project 启动日志错误信息截取如下:" echo "server $ip $project 启动日志错误信息截取如下:"
#echo "sed -n "$[$num-3],$[$num+10]p" $log_path" sed -n "$[$num],$[$num+10]p" $log_path
sed -n "$[$num-2],$[$num+10]p" $log_path
fi fi
exit -1 exit -1
fi fi
...@@ -56,11 +55,10 @@ function ack() ...@@ -56,11 +55,10 @@ function ack()
else else
echo "server $ip $project not startup in ${max_wait_ack_time} seconds..." echo "server $ip $project not startup in ${max_wait_ack_time} seconds..."
#echo "num=`grep -n \"\[ERROR\]\" $log_path | head -1 |cut -d ":" -f 1`" #echo "num=`grep -n \"\[ERROR\]\" $log_path | head -1 |cut -d ":" -f 1`"
num=`grep -n "\[ERROR\]" $log_path | head -1 |cut -d ":" -f 1` num=`grep -n -E "APPLICATION FAILED TO START|Application startup failed" $log_path | cut -d ":" -f 1`
if [ -n "$num" ];then if [ -n "$num" ];then
echo "server $ip $project 启动日志错误信息截取如下:" echo "server $ip $project 启动日志错误信息截取如下:"
#echo "sed -n "$[$num-3],$[$num+10]p" $log_path" sed -n "$[$num],$[$num+10]p" $log_path
sed -n "$[$num-2],$[$num+10]p" $log_path
fi fi
exit -1 exit -1
fi fi
...@@ -78,28 +76,28 @@ sh $config_server/show_info.sh $project 重新启动 $desc $ip ...@@ -78,28 +76,28 @@ sh $config_server/show_info.sh $project 重新启动 $desc $ip
cd $project_path/$project cd $project_path/$project
P_UUID=`ps -ef|grep ${project}.jar |grep -v 'grep'|awk '{print $2}'` P_UUID=`ps -ef|grep ${project}.jar |grep -v 'grep'|awk '{print $2}'`
if [ -n "${P_UUID}" ];then if [ -n "${P_UUID}" ];then
echo "Kill $project PPID=${P_UUID}" echo "Kill $project PPID=${P_UUID}"
kill -9 ${P_UUID} kill ${P_UUID}
sleep 2s sleep 2s
fi fi
config_file=`find ./ -maxdepth 2 -name "application.properties"` config_file=`find ./ -maxdepth 2 -name "application.properties"`
if [ -n "$config_file" ] if [ -n "$config_file" ]
then then
echo "$project already have config file" echo "$project already have config file"
else else
echo "$project have no config file" echo "$project have no config file"
if $is_public_ip && [ -n "$is_public_ip" ] if $is_public_ip && [ -n "$is_public_ip" ]
then then
rm -rf /home/quant_group/${project}/application.properties rm -rf /home/quant_group/${project}/application.properties
echo "ln -s $config_path/public/java/${project}.* /home/quant_group/${project}/application.properties" echo "ln -s $config_path/public/java/${project}.* /home/quant_group/${project}/application.properties"
ln -s $config_path/public/java/${project}.* /home/quant_group/${project}/application.properties ln -s $config_path/public/java/${project}.* /home/quant_group/${project}/application.properties
else else
rm -rf /home/quant_group/${project}/application.properties rm -rf /home/quant_group/${project}/application.properties
echo "ln -s $config_path/java/${project}.* /home/quant_group/${project}/application.properties" echo "ln -s $config_path/java/${project}.* /home/quant_group/${project}/application.properties"
ln -s $config_path/java/${project}.* /home/quant_group/${project}/application.properties ln -s $config_path/java/${project}.* /home/quant_group/${project}/application.properties
fi fi
fi fi
echo "Project: $project will be start" echo "Project: $project will be start"
...@@ -110,24 +108,24 @@ mv $project_path/logs/$log_name $project_path/logs/$log_name.$time ...@@ -110,24 +108,24 @@ mv $project_path/logs/$log_name $project_path/logs/$log_name.$time
echo "$run_command" echo "$run_command"
if [[ $project == "redpacket" ]]; then if [[ $project == "redpacket" ]]; then
java -Xmx512m -XX:PermSize64m -Xloggc:/tmp/${project}.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar ${project}.jar --worker 1 --currentWorker 1 -t -ts > /dev/null 2>&1 & java -Xmx512m -XX:PermSize64m -Xloggc:/tmp/${project}.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar ${project}.jar --worker 1 --currentWorker 1 -t -ts > /dev/null 2>&1 &
else else
java -Xmx512m -XX:PermSize64m -Xloggc:/tmp/${project}.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar ${project}.jar --worker 1 --currentWorker 1 -t > /dev/null 2>&1 & java -Xmx512m -XX:PermSize64m -Xloggc:/tmp/${project}.log -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -jar ${project}.jar --worker 1 --currentWorker 1 -t > /dev/null 2>&1 &
fi fi
if [[ $check_ack == "1" ]]; then if [[ $check_ack == "1" ]]; then
ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} 700 ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} 700
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Fail to start" echo "Fail to start"
exit -1 exit -1
fi fi
else else
ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} ${max_wait_ack_time} ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} ${max_wait_ack_time}
if [ $? -ne 0 ] if [ $? -ne 0 ]
then then
echo "Fail to start" echo "Fail to start"
exit -1 exit -1
fi fi
fi fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment