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
573b1183
Commit
573b1183
authored
Mar 09, 2017
by
张乐
Committed by
GitHub
Mar 09, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #564 from nobodyiam/startup-log
output start up log to console
parents
e28ff8f7
148a375f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
21 deletions
+18
-21
startup.sh
apollo-adminservice/src/main/scripts/startup.sh
+6
-7
startup.sh
apollo-configservice/src/main/scripts/startup.sh
+6
-7
startup.sh
apollo-portal/src/main/scripts/startup.sh
+6
-7
No files found.
apollo-adminservice/src/main/scripts/startup.sh
View file @
573b1183
...
@@ -14,7 +14,6 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
...
@@ -14,7 +14,6 @@ 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
"
STARTUP_LOG
=
$LOG_DIR
"/startup.log"
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
export
JAVA_HOME
=
/usr/java/latest/
export
JAVA_HOME
=
/usr/java/latest/
...
@@ -47,7 +46,7 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
...
@@ -47,7 +46,7 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
rm
-rf
$SERVICE_NAME
".jar"
rm
-rf
$SERVICE_NAME
".jar"
fi
fi
printf
"
$(
date
)
==== Starting ====
\n
"
>
$STARTUP_LOG
printf
"
$(
date
)
==== Starting ====
\n
"
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
...
@@ -57,7 +56,7 @@ rc=$?;
...
@@ -57,7 +56,7 @@ rc=$?;
if
[[
$rc
!=
0
]]
;
if
[[
$rc
!=
0
]]
;
then
then
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
>>
$STARTUP_LOG
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
exit
$rc
;
exit
$rc
;
fi
fi
...
@@ -65,10 +64,10 @@ declare -i counter=0
...
@@ -65,10 +64,10 @@ declare -i counter=0
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
total_time
=
0
declare
-i
total_time
=
0
printf
"Waiting for server startup"
>>
$STARTUP_LOG
printf
"Waiting for server startup"
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
-X
GET
--silent
--connect-timeout
1
--max-time
2
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
-X
GET
--silent
--connect-timeout
1
--max-time
2
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
do
do
printf
"."
>>
$STARTUP_LOG
printf
"."
counter+
=
1
counter+
=
1
sleep
5
sleep
5
done
done
...
@@ -77,10 +76,10 @@ total_time=counter*5
...
@@ -77,10 +76,10 @@ total_time=counter*5
if
[[
((
counter
-ge
max_counter
))
]]
;
if
[[
((
counter
-ge
max_counter
))
]]
;
then
then
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
exit
1
;
exit
1
;
fi
fi
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
exit
0
;
exit
0
;
apollo-configservice/src/main/scripts/startup.sh
View file @
573b1183
...
@@ -14,7 +14,6 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
...
@@ -14,7 +14,6 @@ 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
"
STARTUP_LOG
=
$LOG_DIR
"/startup.log"
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
export
JAVA_HOME
=
/usr/java/latest/
export
JAVA_HOME
=
/usr/java/latest/
...
@@ -47,7 +46,7 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
...
@@ -47,7 +46,7 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
rm
-rf
$SERVICE_NAME
".jar"
rm
-rf
$SERVICE_NAME
".jar"
fi
fi
printf
"
$(
date
)
==== Starting ====
\n
"
>
$STARTUP_LOG
printf
"
$(
date
)
==== Starting ====
\n
"
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
...
@@ -57,7 +56,7 @@ rc=$?;
...
@@ -57,7 +56,7 @@ rc=$?;
if
[[
$rc
!=
0
]]
;
if
[[
$rc
!=
0
]]
;
then
then
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
>>
$STARTUP_LOG
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
exit
$rc
;
exit
$rc
;
fi
fi
...
@@ -65,10 +64,10 @@ declare -i counter=0
...
@@ -65,10 +64,10 @@ declare -i counter=0
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
total_time
=
0
declare
-i
total_time
=
0
printf
"Waiting for server startup"
>>
$STARTUP_LOG
printf
"Waiting for server startup"
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
-X
GET
--silent
--connect-timeout
1
--max-time
2
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
-X
GET
--silent
--connect-timeout
1
--max-time
2
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
do
do
printf
"."
>>
$STARTUP_LOG
printf
"."
counter+
=
1
counter+
=
1
sleep
5
sleep
5
done
done
...
@@ -77,10 +76,10 @@ total_time=counter*5
...
@@ -77,10 +76,10 @@ total_time=counter*5
if
[[
((
counter
-ge
max_counter
))
]]
;
if
[[
((
counter
-ge
max_counter
))
]]
;
then
then
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
exit
1
;
exit
1
;
fi
fi
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
exit
0
;
exit
0
;
apollo-portal/src/main/scripts/startup.sh
View file @
573b1183
...
@@ -14,7 +14,6 @@ export JAVA_OPTS="$JAVA_OPTS -Dserver.port=$SERVER_PORT -Dlogging.file=$LOG_DIR/
...
@@ -14,7 +14,6 @@ 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
"
STARTUP_LOG
=
$LOG_DIR
"/startup.log"
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
if
[[
-z
"
$JAVA_HOME
"
&&
-d
/usr/java/latest/
]]
;
then
export
JAVA_HOME
=
/usr/java/latest/
export
JAVA_HOME
=
/usr/java/latest/
...
@@ -47,7 +46,7 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
...
@@ -47,7 +46,7 @@ if [[ -f $SERVICE_NAME".jar" ]]; then
rm
-rf
$SERVICE_NAME
".jar"
rm
-rf
$SERVICE_NAME
".jar"
fi
fi
printf
"
$(
date
)
==== Starting ====
\n
"
>
$STARTUP_LOG
printf
"
$(
date
)
==== Starting ====
\n
"
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
ln
$PATH_TO_JAR
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
chmod
a+x
$SERVICE_NAME
".jar"
...
@@ -57,7 +56,7 @@ rc=$?;
...
@@ -57,7 +56,7 @@ rc=$?;
if
[[
$rc
!=
0
]]
;
if
[[
$rc
!=
0
]]
;
then
then
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
>>
$STARTUP_LOG
echo
"
$(
date
)
Failed to start
$SERVICE_NAME
.jar, return code:
$rc
"
exit
$rc
;
exit
$rc
;
fi
fi
...
@@ -65,10 +64,10 @@ declare -i counter=0
...
@@ -65,10 +64,10 @@ declare -i counter=0
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
max_counter
=
16
# 16*5=80s
declare
-i
total_time
=
0
declare
-i
total_time
=
0
printf
"Waiting for server startup"
>>
$STARTUP_LOG
printf
"Waiting for server startup"
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
-X
GET
--silent
--connect-timeout
1
--max-time
2
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
until
[[
((
counter
-ge
max_counter
))
||
"
$(
curl
-X
GET
--silent
--connect-timeout
1
--max-time
2
--head
$SERVER_URL
|
grep
"Coyote"
)
"
!=
""
]]
;
do
do
printf
"."
>>
$STARTUP_LOG
printf
"."
counter+
=
1
counter+
=
1
sleep
5
sleep
5
done
done
...
@@ -77,10 +76,10 @@ total_time=counter*5
...
@@ -77,10 +76,10 @@ total_time=counter*5
if
[[
((
counter
-ge
max_counter
))
]]
;
if
[[
((
counter
-ge
max_counter
))
]]
;
then
then
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
printf
"
\n
$(
date
)
Server failed to start in
$total_time
seconds!
\n
"
exit
1
;
exit
1
;
fi
fi
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
>>
$STARTUP_LOG
printf
"
\n
$(
date
)
Server started in
$total_time
seconds!
\n
"
exit
0
;
exit
0
;
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