Here is the command to kill a Java process - this is the name of the process instead of its ProcessID.
kill `jps | grep "DataNode" | cut -d " " -f 1`
Let me explain more about the benefits of this team. Suppose you are working with a Hadoop cluster. It is often required that you check java daemons working with the jps command. Say, when you give this command on work nodes, you see the following result.
1915 NodeManager 18119 DataNode 17680 Jps
Usually, if we want to kill the DataNode process, we will use the following command
kill -9 18119
But, itβs a little difficult to enter a PID to use the kill command. Using the command provided in this answer, it is easy to write the process name. We can also prepare shell scripts to destroy commonly used daemons in a cluster of haops, or we can prepare one shell script and use the parameter as the name of the process.
I bajwa
source share