-
Notifications
You must be signed in to change notification settings - Fork 6.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add shutdown.sh and match other shell script #7020
Conversation
…ppServiceShutdown.sh match other shell script
Codecov Report
@@ Coverage Diff @@
## master #7020 +/- ##
============================================
- Coverage 53.14% 44.69% -8.46%
+ Complexity 4217 2855 -1362
============================================
Files 1865 1852 -13
Lines 40319 39892 -427
Branches 4510 4658 +148
============================================
- Hits 21429 17831 -3598
- Misses 17836 21013 +3177
+ Partials 1054 1048 -6
Continue to review full report at Codecov.
|
@JaredTan95 @innerpeacez Any time to check this script locally? And give a review? |
Okay, I'll check it locally these days. |
dist-material/bin/webappService.sh
Outdated
if [ $? -eq 0 ]; then | ||
sleep 1 | ||
sleep 1 | ||
/bin/echo -n $! > "$UI_PID_FILE" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest moving $!
to line 39 and give it a variable, in case we add background commands between line 38 and this line, the pid will be wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to give it a variable ,because $! is the PID of the last program your shell ran in the background
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't know how to give it a variable ,because $! is the PID of the last program your shell ran in the background
I know. I mean pid=$!
dist-material/bin/oapService.sh
Outdated
echo "SkyWalking OAP started successfully!" | ||
else | ||
echo "SkyWalking OAP started failure!" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep 2 spaces as indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please keep 2 spaces as indentation.
I've completed
echo "SkyWalking OAP started successfully!"
else
echo "SkyWalking OAP started failure!"
echo "SkyWalking Web Application started successfully!"
else
echo "SkyWalking Web Application started failure!"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is suggested to stop the process by signal.
OAP_PID_FILE="${SW_HOME}/bin/oap.pid" | ||
|
||
if [ -f $OAP_PID_FILE ]; then | ||
kill -9 $(cat "$OAP_PID_FILE") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SIGNAL=${SIGNAL:-TERM}
PID=$(cat "$OAP_PID_FILE")
kill -s $SIGNAL $PID
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've complete
SIGNAL=${SIGNAL:-TERM}
PID=$(cat "$OAP_PID_FILE")
kill -s $SIGNAL $PID
I've complete
OAP_PID_FILE="${SW_HOME}/bin/oap.pid"
if [ -f "$OAP_PID_FILE" ]; then
SIGNAL=${SIGNAL:-TERM}
PID=$(cat "$OAP_PID_FILE")
kill -s "$SIGNAL" "$PID"
rm "$OAP_PID_FILE"
echo 'SkyWalking OAP stopped successfully!'
else
echo 'SkyWalking OAP not exist(could not find file $OAP_PID_FILE)!'
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is: Let the user control the SIGNAL used by himself in a variable way, we only provide a default SIGNAL.
@@ -40,10 +40,14 @@ OAP_OPTIONS=" -Doap.logDir=${OAP_LOG_DIR}" | |||
eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} ${OAP_OPTIONS} -classpath $CLASSPATH org.apache.skywalking.oap.server.starter.OAPServerStartUp \ | |||
2>${OAP_LOG_DIR}/oap.log 1> /dev/null &" | |||
|
|||
PID="$!" | |||
OAP_PID_FILE="${OAP_HOME}/bin/oap.pid" | |||
|
|||
if [ $? -eq 0 ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$?
should be also extracted into variable, now, and should be right after eval exec ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like this
OAP_PID_FILE="${OAP_HOME}/bin/oap.pid"
eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} ${OAP_OPTIONS} -classpath $CLASSPATH org.apache.skywalking.oap.server.starter.OAPServerStartUp \
2>${OAP_LOG_DIR}/oap.log 1> /dev/null & /bin/echo -n "$$" > "$OAP_PID_FILE""
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like this
OAP_PID_FILE="${OAP_HOME}/bin/oap.pid" eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} ${OAP_OPTIONS} -classpath $CLASSPATH org.apache.skywalking.oap.server.starter.OAPServerStartUp \ 2>${OAP_LOG_DIR}/oap.log 1> /dev/null & /bin/echo -n "$$" > "$OAP_PID_FILE""
It's ok, but you have to remove the PID file if $? != 0
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like this
OAP_PID_FILE="${OAP_HOME}/bin/oap.pid" eval exec "\"$_RUNJAVA\" ${JAVA_OPTS} ${OAP_OPTIONS} -classpath $CLASSPATH org.apache.skywalking.oap.server.starter.OAPServerStartUp \ 2>${OAP_LOG_DIR}/oap.log 1> /dev/null & /bin/echo -n "$$" > "$OAP_PID_FILE""It's ok, but you have to remove the PID file if
$? != 0
, right?
I'm sorry , i didn't test before, this script can't get correct PID. tomcat shell script
else
eval $_NOHUP "\"$_RUNJAVA\"" "\"$LOGGING_CONFIG\"" $LOGGING_MANAGER "$JAVA_OPTS" "$CATALINA_OPTS" \
-D$ENDORSED_PROP="\"$JAVA_ENDORSED_DIRS\"" \
-classpath "\"$CLASSPATH\"" \
-Dcatalina.base="\"$CATALINA_BASE\"" \
-Dcatalina.home="\"$CATALINA_HOME\"" \
-Djava.io.tmpdir="\"$CATALINA_TMPDIR\"" \
org.apache.catalina.startup.Bootstrap "$@" start \
>> "$CATALINA_OUT" 2>&1 "&"
fi
if [ ! -z "$CATALINA_PID" ]; then
echo $! > "$CATALINA_PID"
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kezhenxu94 Because
if [ ! -z "$CATALINA_PID" ]; then
echo $! > "$CATALINA_PID"
fi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kezhenxu94 Because
if [ ! -z "$CATALINA_PID" ]; then
echo $! > "$CATALINA_PID"
fi
@jgzl Any update? |
I didn't update code |
Closing due to no update. |
remove shutdown.bat and update shutdown.sh,oapServiceShutdown.sh,webappServiceShutdown.sh match other shell script