Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qa-deploy-utils
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
QA
qa-deploy-utils
Commits
09dd9d59
Commit
09dd9d59
authored
Dec 01, 2017
by
智勇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
5c8eb809
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
35 deletions
+33
-35
restartJava.sh
qa_shell_script/base_script/restartJava.sh
+33
-35
No files found.
qa_shell_script/base_script/restartJava.sh
View file @
09dd9d59
...
...
@@ -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
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment