This is an automated email from the ASF dual-hosted git repository.

yuqi4733 pushed a commit to branch test_hive_create_table_timeout
in repository https://gitbox.apache.org/repos/asf/gravitino.git


The following commit(s) were added to refs/heads/test_hive_create_table_timeout 
by this push:
     new 6607d5074 Add check logic.
6607d5074 is described below

commit 6607d5074612f54a842c3a0c655dc22a0f3245e1
Author: yuqi <[email protected]>
AuthorDate: Fri Jul 12 10:49:22 2024 +0800

    Add check logic.
---
 dev/docker/kerberos-hive/start.sh | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/dev/docker/kerberos-hive/start.sh 
b/dev/docker/kerberos-hive/start.sh
index edc5c1114..9207fb825 100644
--- a/dev/docker/kerberos-hive/start.sh
+++ b/dev/docker/kerberos-hive/start.sh
@@ -75,14 +75,17 @@ sed -i "s/mockhost/${HOSTNAME}/g" 
${HIVE_HOME}/conf/hive-site.xml
 # format HDFS
 ${HADOOP_HOME}/bin/hdfs namenode -format -nonInteractive
 
+# Wait the format operation exit total.
+sleep 2 
 # Check Whether the ports are occupied and kill the process
 for port in 3306 9000 9083 10000 10002 50070 50075 50010
 do
   echo "Check whether the port ${port} is occupied..."
-  netstat -tlnp | grep ${port}
-  if [[ $? -eq 0 ]]; then
-    echo "Port ${port} is occupied, killing the process..."
-    pid=$(netstat -tlnp | grep ${port} | awk '{print $7}' | awk -F '/' '{print 
$1}')
+  pid=$(netstat -tlnp | grep ${port} | awk '{print $7}' | awk -F '/' '{print 
$1}')
+  # if pid is not null, kill the process
+  if [[ -n ${pid} ]]; then
+    ps -ef | grep ${pid}
+    echo "The port ${port} is occupied, the process id is ${pid}, killing the 
process..."
     kill -9 ${pid}
   fi
 done

Reply via email to