Commit 09dd9d59 authored by 智勇's avatar 智勇

update

parent 5c8eb809
......@@ -34,11 +34,10 @@ function ack()
fail_flag=`grep -E "APPLICATION FAILED TO START|Application startup failed" ${log_path} | wc -l`
if [ "${fail_flag}" = 1 ];then
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
echo "server $ip $project 启动日志错误信息截取如下:"
#echo "sed -n "$[$num-3],$[$num+10]p" $log_path"
sed -n "$[$num-2],$[$num+10]p" $log_path
sed -n "$[$num],$[$num+10]p" $log_path
fi
exit -1
fi
......@@ -56,11 +55,10 @@ function ack()
else
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`"
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
echo "server $ip $project 启动日志错误信息截取如下:"
#echo "sed -n "$[$num-3],$[$num+10]p" $log_path"
sed -n "$[$num-2],$[$num+10]p" $log_path
sed -n "$[$num],$[$num+10]p" $log_path
fi
exit -1
fi
......@@ -78,28 +76,28 @@ sh $config_server/show_info.sh $project 重新启动 $desc $ip
cd $project_path/$project
P_UUID=`ps -ef|grep ${project}.jar |grep -v 'grep'|awk '{print $2}'`
if [ -n "${P_UUID}" ];then
echo "Kill $project PPID=${P_UUID}"
kill -9 ${P_UUID}
sleep 2s
echo "Kill $project PPID=${P_UUID}"
kill ${P_UUID}
sleep 2s
fi
config_file=`find ./ -maxdepth 2 -name "application.properties"`
if [ -n "$config_file" ]
then
echo "$project already have config file"
echo "$project already have config file"
else
echo "$project have no config file"
if $is_public_ip && [ -n "$is_public_ip" ]
then
rm -rf /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
else
rm -rf /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
fi
echo "$project have no config file"
if $is_public_ip && [ -n "$is_public_ip" ]
then
rm -rf /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
else
rm -rf /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
fi
fi
echo "Project: $project will be start"
......@@ -110,24 +108,24 @@ mv $project_path/logs/$log_name $project_path/logs/$log_name.$time
echo "$run_command"
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
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
if [[ $check_ack == "1" ]]; then
ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} 700
if [ $? -ne 0 ]
then
echo "Fail to start"
exit -1
fi
ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} 700
if [ $? -ne 0 ]
then
echo "Fail to start"
exit -1
fi
else
ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} ${max_wait_ack_time}
if [ $? -ne 0 ]
then
echo "Fail to start"
exit -1
fi
ack "$ack_phrase" $project_path/logs/$log_name ${max_wait_log_generate_time} ${max_wait_ack_time}
if [ $? -ne 0 ]
then
echo "Fail to start"
exit -1
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