Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
apollo
Project
Overview
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
openSource
apollo
Commits
d61803b4
Commit
d61803b4
authored
Aug 15, 2017
by
张乐
Committed by
GitHub
Aug 15, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #697 from nobodyiam/startup-check-pid
startup script check whether pid is alive
parents
c0ffb555
cc6cd07e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
3 deletions
+63
-3
startup.sh
apollo-adminservice/src/main/scripts/startup.sh
+21
-1
startup.sh
apollo-configservice/src/main/scripts/startup.sh
+21
-1
startup.sh
apollo-portal/src/main/scripts/startup.sh
+21
-1
No files found.
apollo-adminservice/src/main/scripts/startup.sh
View file @
d61803b4
...
@@ -18,6 +18,24 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
...
@@ -18,6 +18,24 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
function
checkPidAlive
{
for
i
in
`
ls
-t
$SERVICE_NAME
*
.pid 2>/dev/null
`
do
read
pid <
$i
result
=
$(
ps
-p
"
$pid
"
)
if
[
"
$?
"
-eq
0
]
;
then
return
0
else
printf
"
\n
pid -
$pid
just quit unexpectedly, please check logs under
$LOG_DIR
and /tmp for more information!
\n
"
exit
1
;
fi
done
printf
"
\n
No pid file found, startup may failed. Please check logs under
$LOG_DIR
and /tmp for more information!
\n
"
exit
1
;
}
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
windows
=
"0"
windows
=
"0"
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
...
@@ -77,7 +95,7 @@ then
...
@@ -77,7 +95,7 @@ then
fi
fi
declare
-i
counter
=
0
declare
-i
counter
=
0
declare
-i
max_counter
=
16
# 16*5=8
0s
declare
-i
max_counter
=
48
# 48*5=24
0s
declare
-i
total_time
=
0
declare
-i
total_time
=
0
printf
"Waiting for server startup"
printf
"Waiting for server startup"
...
@@ -86,6 +104,8 @@ do
...
@@ -86,6 +104,8 @@ do
printf
"."
printf
"."
counter+
=
1
counter+
=
1
sleep
5
sleep
5
checkPidAlive
done
done
total_time
=
counter
*
5
total_time
=
counter
*
5
...
...
apollo-configservice/src/main/scripts/startup.sh
View file @
d61803b4
...
@@ -18,6 +18,24 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
...
@@ -18,6 +18,24 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
function
checkPidAlive
{
for
i
in
`
ls
-t
$SERVICE_NAME
*
.pid 2>/dev/null
`
do
read
pid <
$i
result
=
$(
ps
-p
"
$pid
"
)
if
[
"
$?
"
-eq
0
]
;
then
return
0
else
printf
"
\n
pid -
$pid
just quit unexpectedly, please check logs under
$LOG_DIR
and /tmp for more information!
\n
"
exit
1
;
fi
done
printf
"
\n
No pid file found, startup may failed. Please check logs under
$LOG_DIR
and /tmp for more information!
\n
"
exit
1
;
}
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
windows
=
"0"
windows
=
"0"
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
...
@@ -77,7 +95,7 @@ then
...
@@ -77,7 +95,7 @@ then
fi
fi
declare
-i
counter
=
0
declare
-i
counter
=
0
declare
-i
max_counter
=
16
# 16*5=8
0s
declare
-i
max_counter
=
48
# 48*5=24
0s
declare
-i
total_time
=
0
declare
-i
total_time
=
0
printf
"Waiting for server startup"
printf
"Waiting for server startup"
...
@@ -86,6 +104,8 @@ do
...
@@ -86,6 +104,8 @@ do
printf
"."
printf
"."
counter+
=
1
counter+
=
1
sleep
5
sleep
5
checkPidAlive
done
done
total_time
=
counter
*
5
total_time
=
counter
*
5
...
...
apollo-portal/src/main/scripts/startup.sh
View file @
d61803b4
...
@@ -18,6 +18,24 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
...
@@ -18,6 +18,24 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
PATH_TO_JAR
=
$SERVICE_NAME
".jar"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
SERVER_URL
=
"http://localhost:
$SERVER_PORT
"
function
checkPidAlive
{
for
i
in
`
ls
-t
$SERVICE_NAME
*
.pid 2>/dev/null
`
do
read
pid <
$i
result
=
$(
ps
-p
"
$pid
"
)
if
[
"
$?
"
-eq
0
]
;
then
return
0
else
printf
"
\n
pid -
$pid
just quit unexpectedly, please check logs under
$LOG_DIR
and /tmp for more information!
\n
"
exit
1
;
fi
done
printf
"
\n
No pid file found, startup may failed. Please check logs under
$LOG_DIR
and /tmp for more information!
\n
"
exit
1
;
}
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
if
[
"
$(
uname
)
"
==
"Darwin"
]
;
then
windows
=
"0"
windows
=
"0"
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
elif
[
"
$(
expr
substr
$(
uname
-s
)
1 5
)
"
==
"Linux"
]
;
then
...
@@ -77,7 +95,7 @@ then
...
@@ -77,7 +95,7 @@ then
fi
fi
declare
-i
counter
=
0
declare
-i
counter
=
0
declare
-i
max_counter
=
16
# 16*5=8
0s
declare
-i
max_counter
=
48
# 48*5=24
0s
declare
-i
total_time
=
0
declare
-i
total_time
=
0
printf
"Waiting for server startup"
printf
"Waiting for server startup"
...
@@ -86,6 +104,8 @@ do
...
@@ -86,6 +104,8 @@ do
printf
"."
printf
"."
counter+
=
1
counter+
=
1
sleep
5
sleep
5
checkPidAlive
done
done
total_time
=
counter
*
5
total_time
=
counter
*
5
...
...
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