Skip to content
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

[IOTDB-6077]: Stop script addition -f #10637

Merged
merged 1 commit into from
Jul 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,24 @@ else
exit 1
fi

force=""

while true; do
case "$1" in
-f)
force="yes"
break
;;
"")
#if we do not use getopt, we then have to process the case that there is no argument.
#in some systems, when there is no argument, shift command may throw error, so we skip directly
#all others are args to the program
PARAMS=$*
break
;;
esac
done

PID_VERIFY=$(ps ax | grep -i 'ConfigNode' | grep java | grep -v grep | awk '{print $1}')
if [ -z "$PID" ]; then
echo "No ConfigNode to stop"
Expand All @@ -42,8 +60,13 @@ if [ -z "$PID" ]; then
fi
exit 1
elif [[ "${PID_VERIFY}" =~ ${PID} ]]; then
kill -s TERM "$PID"
echo "Close ConfigNode, PID:" "$PID"
if [[ "${force}" == "yes" ]]; then
kill -9 "$PID"
echo "Force to stop ConfigNode, PID:" "$PID"
else
kill -s TERM "$PID"
echo "Stop ConfigNode, PID:" "$PID"
fi
else
echo "No ConfigNode to stop"
exit 1
Expand Down
27 changes: 25 additions & 2 deletions iotdb-core/datanode/src/assembly/resources/sbin/stop-datanode.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,24 @@
DATANODE_CONF="`dirname "$0"`/../conf"
dn_rpc_port=`sed '/^dn_rpc_port=/!d;s/.*=//' ${DATANODE_CONF}/iotdb-datanode.properties`

force=""

while true; do
case "$1" in
-f)
force="yes"
break
;;
"")
#if we do not use getopt, we then have to process the case that there is no argument.
#in some systems, when there is no argument, shift command may throw error, so we skip directly
#all others are args to the program
PARAMS=$*
break
;;
esac
done

echo "Check whether the rpc_port is used..., port is" $dn_rpc_port

if type lsof > /dev/null 2>&1 ; then
Expand All @@ -42,8 +60,13 @@ if [ -z "$PID" ]; then
fi
exit 1
elif [[ "${PID_VERIFY}" =~ ${PID} ]]; then
kill -s TERM "$PID"
echo "Stop DataNode, PID:" "$PID"
if [[ "${force}" == "yes" ]]; then
kill -9 "$PID"
echo "Force to stop DataNode, PID:" "$PID"
else
kill -s TERM "$PID"
echo "Stop DataNode, PID:" "$PID"
fi
else
echo "No DataNode to stop"
exit 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,25 @@ if [ -z "${IOTDB_HOME}" ]; then
export IOTDB_HOME="`dirname "$0"`/.."
fi


force=""

while true; do
case "$1" in
-f)
force="yes"
break
;;
"")
#if we do not use getopt, we then have to process the case that there is no argument.
#in some systems, when there is no argument, shift command may throw error, so we skip directly
#all others are args to the program
PARAMS=$*
break
;;
esac
done

if [ -f "$IOTDB_HOME/sbin/stop-confignode.sh" ]; then
export CONFIGNODE_STOP_PATH="$IOTDB_HOME/sbin/stop-confignode.sh"
else
Expand All @@ -36,5 +55,13 @@ else
exit 0
fi

bash "$CONFIGNODE_STOP_PATH"
bash "$DATANODE_STOP_PATH"


if [[ "${force}" == "yes" ]]; then
echo "Force stop all nodes"
bash "$CONFIGNODE_STOP_PATH" -f
bash "$DATANODE_STOP_PATH" -f
else
bash "$CONFIGNODE_STOP_PATH"
bash "$DATANODE_STOP_PATH"
fi
Loading