Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
antai-sport-http-server
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
antai-sport
antai-sport-http-server
Commits
396948f7
Commit
396948f7
authored
Jun 08, 2022
by
liming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
初始化团长管理端
parent
24a72f38
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
98 additions
and
1 deletion
+98
-1
deploy-team-training-leader-api.sh
deploy/deploy-team-training-leader-api.sh
+97
-0
pom.xml
team-training-leader-api/pom.xml
+1
-1
No files found.
deploy/deploy-team-training-leader-api.sh
0 → 100644
View file @
396948f7
#!/bin/bash
# 修改APP_NAME为云效上的应用名
APP_NAME
=
antai-sport-http-server-team-training-leader-api
PROG_NAME
=
$0
ACTION
=
$1
BASE_HOME
=
/usr/local/project/team-training-leader-api/team-training-leader-api/target
APP_START_TIMEOUT
=
30
# 等待应用启动的时间
APP_PORT
=
8087
# 应用端口
HEALTH_CHECK_URL
=
http://127.0.0.1:
${
APP_PORT
}
# 应用健康检查URL
JAR_NAME
=
${
BASE_HOME
}
/
${
APP_NAME
}
.jar
# jar包的名字
usage
()
{
echo
"Usage:
$PROG_NAME
{start|stop|restart}"
exit
2
}
health_check
()
{
exptime
=
0
echo
"checking
${
HEALTH_CHECK_URL
}
"
while
true
do
status_code
=
`
/usr/bin/curl
-L
-o
/dev/null
--connect-timeout
5
-s
-w
%
{
http_code
}
${
HEALTH_CHECK_URL
}
`
if
[
"
$?
"
!=
"0"
]
;
then
echo
-n
-e
"
\r
application not started"
else
echo
"code is
$status_code
"
if
[
"
$status_code
"
==
"200"
]
;
then
break
fi
fi
sleep
1
((
exptime++
))
echo
-e
"
\r
Wait app to pass health check:
$exptime
..."
if
[
$exptime
-gt
${
APP_START_TIMEOUT
}
]
;
then
echo
'app start failed'
exit
1
fi
done
echo
"check
${
HEALTH_CHECK_URL
}
success"
}
start_application
()
{
echo
"starting java process"
nohup
java
-jar
${
JAR_NAME
}
--spring
.profiles.active
=
prod
--server
.port
=
${
APP_PORT
}
>
/dev/null 2>&1 &
echo
"started java process"
}
stop_application
()
{
checkjavapid
=
`
ps
-ef
|
grep
java |
grep
${
APP_NAME
}
|
grep
-v
grep
|grep
-v
'deploy.sh'
|
awk
'{print$2}'
`
if
[[
!
$checkjavapid
]]
;
then
echo
-e
"
\r
no java process"
return
fi
echo
"stop java process"
times
=
60
for
e
in
$(
seq
60
)
do
sleep
1
COSTTIME
=
$((
$times
-
$e
))
checkjavapid
=
`
ps
-ef
|
grep
java |
grep
${
APP_NAME
}
|
grep
-v
grep
|grep
-v
'deploy.sh'
|
awk
'{print$2}'
`
if
[[
$checkjavapid
]]
;
then
kill
-9
$checkjavapid
echo
-e
"
\r
-- stopping java lasts
`
expr
$COSTTIME
`
seconds."
else
echo
-e
"
\r
java process has exited"
break
;
fi
done
echo
""
}
start
()
{
start_application
health_check
}
stop
()
{
stop_application
}
case
"
$ACTION
"
in
start
)
start
;;
stop
)
stop
;;
restart
)
stop
start
;;
*
)
usage
;;
esac
\ No newline at end of file
team-training-leader-api/pom.xml
View file @
396948f7
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
</dependencies>
</dependencies>
<build>
<build>
<finalName>
antai-sport-http-server-
management
-api
</finalName>
<finalName>
antai-sport-http-server-
team-training-leader
-api
</finalName>
<plugins>
<plugins>
<plugin>
<plugin>
<artifactId>
maven-compiler-plugin
</artifactId>
<artifactId>
maven-compiler-plugin
</artifactId>
...
...
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