You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@bookkeeper.apache.org by GitBox <gi...@apache.org> on 2022/11/16 02:59:00 UTC
[GitHub] [bookkeeper] gaozhangmin opened a new pull request, #3649: bookkeeper-daemon script supports restart command
gaozhangmin opened a new pull request, #3649:
URL: https://github.com/apache/bookkeeper/pull/3649
bookkeeper-daemon script supports restart command
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] gaozhangmin commented on pull request #3649: bookkeeper-daemon script supports restart command
Posted by GitBox <gi...@apache.org>.
gaozhangmin commented on PR #3649:
URL: https://github.com/apache/bookkeeper/pull/3649#issuecomment-1318275042
> Please check the indent, looks like sometimes they are two spaces, sometimes they are four spaces.
@zymap done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] zymap merged pull request #3649: bookkeeper-daemon script supports restart command
Posted by GitBox <gi...@apache.org>.
zymap merged PR #3649:
URL: https://github.com/apache/bookkeeper/pull/3649
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] zymap commented on a diff in pull request #3649: bookkeeper-daemon script supports restart command
Posted by GitBox <gi...@apache.org>.
zymap commented on code in PR #3649:
URL: https://github.com/apache/bookkeeper/pull/3649#discussion_r1025889343
##########
bin/bookkeeper-daemon.sh:
##########
@@ -108,9 +108,9 @@ rotate_out_log ()
mkdir -p "$BOOKIE_LOG_DIR"
-case $startStop in
- (start)
- if [ -f $pid_file ]; then
+start()
+{
+ if [ -f $pid_file ]; then
Review Comment:
line 114 to 130 still have the indent issue. They need to move forward.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] zymap commented on a diff in pull request #3649: bookkeeper-daemon script supports restart command
Posted by GitBox <gi...@apache.org>.
zymap commented on code in PR #3649:
URL: https://github.com/apache/bookkeeper/pull/3649#discussion_r1025889399
##########
bin/bookkeeper-daemon.sh:
##########
@@ -128,10 +128,11 @@ case $startStop in
if ! kill -0 $! > /dev/null ; then
exit 1
fi
- ;;
+}
- (stop)
- if [ -f $pid_file ]; then
+stop()
+{
+ if [ -f $pid_file ]; then
Review Comment:
same issue with above.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] gaozhangmin commented on pull request #3649: bookkeeper-daemon script supports restart command
Posted by GitBox <gi...@apache.org>.
gaozhangmin commented on PR #3649:
URL: https://github.com/apache/bookkeeper/pull/3649#issuecomment-1316860948
rerun failure checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] gaozhangmin commented on pull request #3649: bookkeeper-daemon script supports restart command
Posted by GitBox <gi...@apache.org>.
gaozhangmin commented on PR #3649:
URL: https://github.com/apache/bookkeeper/pull/3649#issuecomment-1316351896
rerun failure checks
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [bookkeeper] nicoloboschi commented on a diff in pull request #3649: bookkeeper-daemon script supports restart command
Posted by GitBox <gi...@apache.org>.
nicoloboschi commented on code in PR #3649:
URL: https://github.com/apache/bookkeeper/pull/3649#discussion_r1023638622
##########
bin/bookkeeper-daemon.sh:
##########
@@ -108,74 +108,101 @@ rotate_out_log ()
mkdir -p "$BOOKIE_LOG_DIR"
-case $startStop in
- (start)
- if [ -f $pid_file ]; then
- PREVIOUS_PID=$(cat $pid_file)
- if kill -0 $PREVIOUS_PID > /dev/null 2>&1; then
- echo $command running as process $PREVIOUS_PID. Stop it first.
+start()
+{
+ if [ -f $pid_file ]; then
+ PREVIOUS_PID=$(cat $pid_file)
+ if kill -0 $PREVIOUS_PID > /dev/null 2>&1; then
+ echo $command running as process $PREVIOUS_PID. Stop it first.
+ exit 1
+ fi
+ fi
+
+ rotate_out_log $out
+ echo starting $command, logging to $logfile
+ bookkeeper=$BK_HOME/bin/bookkeeper
+ nohup $bookkeeper $command "$@" > "$out" 2>&1 < /dev/null &
+ echo $! > $pid_file
+ sleep 1; head $out
+ sleep 2;
+ if ! kill -0 $! > /dev/null ; then
exit 1
fi
- fi
-
- rotate_out_log $out
- echo starting $command, logging to $logfile
- bookkeeper=$BK_HOME/bin/bookkeeper
- nohup $bookkeeper $command "$@" > "$out" 2>&1 < /dev/null &
- echo $! > $pid_file
- sleep 1; head $out
- sleep 2;
- if ! kill -0 $! > /dev/null ; then
- exit 1
- fi
- ;;
+}
- (stop)
- if [ -f $pid_file ]; then
- TARGET_PID=$(cat $pid_file)
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
- echo stopping $command
- kill $TARGET_PID
-
- count=0
- location=$BOOKIE_LOG_DIR
- while kill -0 $TARGET_PID > /dev/null 2>&1;
- do
- echo "Shutdown is in progress... Please wait..."
- sleep 1
- count=$(expr $count + 1)
-
- if [ "$count" = "$BOOKIE_STOP_TIMEOUT" ]; then
- break
+stop()
+{
+ if [ -f $pid_file ]; then
+ TARGET_PID=$(cat $pid_file)
+ if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ echo stopping $command
+ kill $TARGET_PID
+
+ count=0
+ location=$BOOKIE_LOG_DIR
+ while kill -0 $TARGET_PID > /dev/null 2>&1;
+ do
+ echo "Shutdown is in progress... Please wait..."
+ sleep 1
+ count=$(expr $count + 1)
+
+ if [ "$count" = "$BOOKIE_STOP_TIMEOUT" ]; then
+ break
+ fi
+ done
+
+ if [ "$count" != "$BOOKIE_STOP_TIMEOUT" ]; then
+ echo "Shutdown completed."
fi
- done
-
- if [ "$count" != "$BOOKIE_STOP_TIMEOUT" ]; then
- echo "Shutdown completed."
- fi
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
- fileName=$location/$command.out
- $JAVA_HOME/bin/jstack $TARGET_PID > $fileName
- echo Thread dumps are taken for analysis at $fileName
- if [ "$1" == "-force" ]
- then
- echo forcefully stopping $command
- kill -9 $TARGET_PID >/dev/null 2>&1
- echo Successfully stopped the process
- else
- echo "WARNNING : Bookie Server is not stopped completely."
- exit 1
+ if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ fileName=$location/$command.out
+ $JAVA_HOME/bin/jstack $TARGET_PID > $fileName
+ echo Thread dumps are taken for analysis at $fileName
+ if [ "$1" == "-force" ]
+ then
+ echo forcefully stopping $command
+ kill -9 $TARGET_PID >/dev/null 2>&1
+ echo Successfully stopped the process
+ else
+ echo "WARNNING : Bookie Server is not stopped completely."
+ exit 1
+ fi
fi
+ else
+ echo no $command to stop
fi
+ rm $pid_file
else
echo no $command to stop
fi
- rm $pid_file
- else
- echo no $command to stop
- fi
+}
+case $startStop in
+ (start)
+ start "$*"
+ ;;
+
+ (stop)
+ stop $1
;;
+ (restart)
+ forceStopFlag=$(echo "$*"|grep "\-force")
+ if [[ "$forceStopFlag" != "" ]]
+ then
+ stop "-force"
+ else
+ stop
+ fi
+ if [ "$?" == 0 ]
+ then
+ sleep 3
+ paramaters="$*"
Review Comment:
typo: parameters
##########
bin/bookkeeper-daemon.sh:
##########
@@ -108,74 +108,101 @@ rotate_out_log ()
mkdir -p "$BOOKIE_LOG_DIR"
-case $startStop in
- (start)
- if [ -f $pid_file ]; then
- PREVIOUS_PID=$(cat $pid_file)
- if kill -0 $PREVIOUS_PID > /dev/null 2>&1; then
- echo $command running as process $PREVIOUS_PID. Stop it first.
+start()
+{
+ if [ -f $pid_file ]; then
+ PREVIOUS_PID=$(cat $pid_file)
+ if kill -0 $PREVIOUS_PID > /dev/null 2>&1; then
+ echo $command running as process $PREVIOUS_PID. Stop it first.
+ exit 1
+ fi
+ fi
+
+ rotate_out_log $out
+ echo starting $command, logging to $logfile
+ bookkeeper=$BK_HOME/bin/bookkeeper
+ nohup $bookkeeper $command "$@" > "$out" 2>&1 < /dev/null &
+ echo $! > $pid_file
+ sleep 1; head $out
+ sleep 2;
+ if ! kill -0 $! > /dev/null ; then
exit 1
fi
- fi
-
- rotate_out_log $out
- echo starting $command, logging to $logfile
- bookkeeper=$BK_HOME/bin/bookkeeper
- nohup $bookkeeper $command "$@" > "$out" 2>&1 < /dev/null &
- echo $! > $pid_file
- sleep 1; head $out
- sleep 2;
- if ! kill -0 $! > /dev/null ; then
- exit 1
- fi
- ;;
+}
- (stop)
- if [ -f $pid_file ]; then
- TARGET_PID=$(cat $pid_file)
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
- echo stopping $command
- kill $TARGET_PID
-
- count=0
- location=$BOOKIE_LOG_DIR
- while kill -0 $TARGET_PID > /dev/null 2>&1;
- do
- echo "Shutdown is in progress... Please wait..."
- sleep 1
- count=$(expr $count + 1)
-
- if [ "$count" = "$BOOKIE_STOP_TIMEOUT" ]; then
- break
+stop()
+{
+ if [ -f $pid_file ]; then
+ TARGET_PID=$(cat $pid_file)
+ if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ echo stopping $command
+ kill $TARGET_PID
+
+ count=0
+ location=$BOOKIE_LOG_DIR
+ while kill -0 $TARGET_PID > /dev/null 2>&1;
+ do
+ echo "Shutdown is in progress... Please wait..."
+ sleep 1
+ count=$(expr $count + 1)
+
+ if [ "$count" = "$BOOKIE_STOP_TIMEOUT" ]; then
+ break
+ fi
+ done
+
+ if [ "$count" != "$BOOKIE_STOP_TIMEOUT" ]; then
+ echo "Shutdown completed."
fi
- done
-
- if [ "$count" != "$BOOKIE_STOP_TIMEOUT" ]; then
- echo "Shutdown completed."
- fi
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
- fileName=$location/$command.out
- $JAVA_HOME/bin/jstack $TARGET_PID > $fileName
- echo Thread dumps are taken for analysis at $fileName
- if [ "$1" == "-force" ]
- then
- echo forcefully stopping $command
- kill -9 $TARGET_PID >/dev/null 2>&1
- echo Successfully stopped the process
- else
- echo "WARNNING : Bookie Server is not stopped completely."
- exit 1
+ if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ fileName=$location/$command.out
+ $JAVA_HOME/bin/jstack $TARGET_PID > $fileName
+ echo Thread dumps are taken for analysis at $fileName
+ if [ "$1" == "-force" ]
+ then
+ echo forcefully stopping $command
+ kill -9 $TARGET_PID >/dev/null 2>&1
+ echo Successfully stopped the process
+ else
+ echo "WARNNING : Bookie Server is not stopped completely."
+ exit 1
+ fi
fi
+ else
+ echo no $command to stop
fi
+ rm $pid_file
else
echo no $command to stop
fi
- rm $pid_file
- else
- echo no $command to stop
- fi
+}
+case $startStop in
+ (start)
+ start "$*"
+ ;;
+
+ (stop)
+ stop $1
;;
+ (restart)
+ forceStopFlag=$(echo "$*"|grep "\-force")
+ if [[ "$forceStopFlag" != "" ]]
+ then
+ stop "-force"
+ else
+ stop
+ fi
+ if [ "$?" == 0 ]
+ then
+ sleep 3
+ paramaters="$*"
+ startParamaters=${paramaters//-force/}
+ start "$startParamaters"
+ else
+ echo "WARNNING : $command failed restart, for $command is not stopped completely."
Review Comment:
```suggestion
echo "WARNING : $command restart failed, $command is not stopped completely."
```
##########
bin/bookkeeper-daemon.sh:
##########
@@ -108,74 +108,101 @@ rotate_out_log ()
mkdir -p "$BOOKIE_LOG_DIR"
-case $startStop in
- (start)
- if [ -f $pid_file ]; then
- PREVIOUS_PID=$(cat $pid_file)
- if kill -0 $PREVIOUS_PID > /dev/null 2>&1; then
- echo $command running as process $PREVIOUS_PID. Stop it first.
+start()
+{
+ if [ -f $pid_file ]; then
+ PREVIOUS_PID=$(cat $pid_file)
+ if kill -0 $PREVIOUS_PID > /dev/null 2>&1; then
+ echo $command running as process $PREVIOUS_PID. Stop it first.
+ exit 1
+ fi
+ fi
+
+ rotate_out_log $out
+ echo starting $command, logging to $logfile
+ bookkeeper=$BK_HOME/bin/bookkeeper
+ nohup $bookkeeper $command "$@" > "$out" 2>&1 < /dev/null &
+ echo $! > $pid_file
+ sleep 1; head $out
+ sleep 2;
+ if ! kill -0 $! > /dev/null ; then
exit 1
fi
- fi
-
- rotate_out_log $out
- echo starting $command, logging to $logfile
- bookkeeper=$BK_HOME/bin/bookkeeper
- nohup $bookkeeper $command "$@" > "$out" 2>&1 < /dev/null &
- echo $! > $pid_file
- sleep 1; head $out
- sleep 2;
- if ! kill -0 $! > /dev/null ; then
- exit 1
- fi
- ;;
+}
- (stop)
- if [ -f $pid_file ]; then
- TARGET_PID=$(cat $pid_file)
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
- echo stopping $command
- kill $TARGET_PID
-
- count=0
- location=$BOOKIE_LOG_DIR
- while kill -0 $TARGET_PID > /dev/null 2>&1;
- do
- echo "Shutdown is in progress... Please wait..."
- sleep 1
- count=$(expr $count + 1)
-
- if [ "$count" = "$BOOKIE_STOP_TIMEOUT" ]; then
- break
+stop()
+{
+ if [ -f $pid_file ]; then
+ TARGET_PID=$(cat $pid_file)
+ if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ echo stopping $command
+ kill $TARGET_PID
+
+ count=0
+ location=$BOOKIE_LOG_DIR
+ while kill -0 $TARGET_PID > /dev/null 2>&1;
+ do
+ echo "Shutdown is in progress... Please wait..."
+ sleep 1
+ count=$(expr $count + 1)
+
+ if [ "$count" = "$BOOKIE_STOP_TIMEOUT" ]; then
+ break
+ fi
+ done
+
+ if [ "$count" != "$BOOKIE_STOP_TIMEOUT" ]; then
+ echo "Shutdown completed."
fi
- done
-
- if [ "$count" != "$BOOKIE_STOP_TIMEOUT" ]; then
- echo "Shutdown completed."
- fi
- if kill -0 $TARGET_PID > /dev/null 2>&1; then
- fileName=$location/$command.out
- $JAVA_HOME/bin/jstack $TARGET_PID > $fileName
- echo Thread dumps are taken for analysis at $fileName
- if [ "$1" == "-force" ]
- then
- echo forcefully stopping $command
- kill -9 $TARGET_PID >/dev/null 2>&1
- echo Successfully stopped the process
- else
- echo "WARNNING : Bookie Server is not stopped completely."
- exit 1
+ if kill -0 $TARGET_PID > /dev/null 2>&1; then
+ fileName=$location/$command.out
+ $JAVA_HOME/bin/jstack $TARGET_PID > $fileName
+ echo Thread dumps are taken for analysis at $fileName
+ if [ "$1" == "-force" ]
+ then
+ echo forcefully stopping $command
+ kill -9 $TARGET_PID >/dev/null 2>&1
+ echo Successfully stopped the process
+ else
+ echo "WARNNING : Bookie Server is not stopped completely."
+ exit 1
+ fi
fi
+ else
+ echo no $command to stop
fi
+ rm $pid_file
else
echo no $command to stop
fi
- rm $pid_file
- else
- echo no $command to stop
- fi
+}
+case $startStop in
+ (start)
+ start "$*"
+ ;;
+
+ (stop)
+ stop $1
;;
+ (restart)
+ forceStopFlag=$(echo "$*"|grep "\-force")
+ if [[ "$forceStopFlag" != "" ]]
+ then
+ stop "-force"
+ else
+ stop
+ fi
+ if [ "$?" == 0 ]
+ then
+ sleep 3
+ paramaters="$*"
+ startParamaters=${paramaters//-force/}
Review Comment:
just a nit: if one of the command we have to start here accepts a flag like `-force-xxx` it will be blanked as well
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@bookkeeper.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org